pdataconv

package
v0.28.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package pdataconv is the optional OTel-Go bridge: it converts the collector pdata metrics type (pmetric.Metrics) into the storage library's internal, []byte-based metric.Metrics ingest batch. It exists so OTel users get zero-friction ingestion without the pdata dependency or its allocation profile reaching the storage hot path — pdata is referenced only here, never by the core packages or the storage facade.

The conversion necessarily allocates: pdata stores keys/values as Go strings, so projecting them to the internal []byte model copies each one. Embedders that decode OTLP protobuf themselves should build metric.Metrics directly (aliasing the decode buffer) to stay allocation-free; this bridge is the compatibility path, not the fast path.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendLogs added in v0.3.0

func AppendLogs(dst *log.Logs, ld plog.Logs) (dropped int)

AppendLogs converts an OTLP logs batch into dst, reusing dst's retained capacity (call log.Logs.Reset or use log.GetLogs for a recycled batch). Every record is representable, so dropped is always 0; it is returned for symmetry with AppendMetrics. Non-string record bodies are rendered to their textual form, since the internal model stores a body as text bytes.

func AppendMetrics

func AppendMetrics(dst *metric.Metrics, md pmetric.Metrics) (dropped int)

AppendMetrics converts an OTLP metrics batch into dst, reusing dst's retained capacity (call metric.Metrics.Reset or use metric.GetMetrics for a recycled batch). Gauge and sum number points convert directly; histogram, exponential-histogram, and summary points are stored by **classic decomposition** into `_count`/`_sum`/`_bucket{le}`/`{quantile}` float series (see histogram.go), so they need no engine support. Only value-less number points are skipped and counted in dropped so the caller can fold them into an OTLP partial-success response.

func AppendProfiles added in v0.3.0

func AppendProfiles(dst *profile.Profiles, pd pprofile.Profiles) (dropped int)

AppendProfiles converts an OTLP profiles batch into dst, reusing dst's retained capacity (call profile.Profiles.Reset or use profile.GetProfiles for a recycled batch). The OTLP shared ProfilesDictionary maps one-to-one onto profile.Dictionary, so its tables are copied index-preserving (samples/stacks/locations keep referencing the same indices). Everything is representable, so dropped is always 0; it is returned for symmetry with AppendMetrics.

func AppendTraces added in v0.3.0

func AppendTraces(dst *trace.Traces, td ptrace.Traces) (dropped int)

AppendTraces converts an OTLP traces batch into dst, reusing dst's retained capacity (call trace.Traces.Reset or use trace.GetTraces for a recycled batch). Every span, event, and link is representable, so dropped is always 0; it is returned for symmetry with AppendMetrics and to leave room for future unrepresentable cases.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL