You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2026-06-03 18:35:08 +02:00
b1284dbfaa
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/8164 Supersedes #8042 which does not address the `trace` or `zipkin` packages, and has unrelated support changes. Add end-to-end handling for `attribute.BYTESLICE` in the remaining trace and exporter paths that still dropped, invalidated, or stringified byte slice attributes. This change: - preserves byte slice attributes in `trace/auto` - encodes byte slice attributes as OTLP `AnyValue_BytesValue` in trace, log, and metric transforms - serializes Zipkin byte slice attributes as JSON arrays of byte values - adds regression tests for each updated path ## Problem `attribute.BYTESLICE` is public, but several downstream conversions still did not handle it correctly: - `trace/auto` dropped byte slice attributes during conversion - OTLP trace, log, and metric transforms fell through to their invalid default handling - Zipkin fell back to `Value.Emit()`, which produced a base64 string rather than an explicit byte-array representation That made `BYTESLICE` unusable or inconsistent depending on the export path. ## Changes ### Trace - Handle `attribute.BYTESLICE` in `trace/auto` by converting it to an internal telemetry bytes value. - Add a regression test covering byte slice conversion. ### OTLP - Handle `attribute.BYTESLICE` in: - trace attribute transform - log gRPC attribute transform - log HTTP attribute transform - metric HTTP attribute transform - metric gRPC attribute transform - Update the shared log and metric transform templates so generated outputs stay aligned. - Add regression tests for the trace transform, both log transform outputs, and both metric transform outputs. ### Zipkin - Handle `attribute.BYTESLICE` explicitly in Zipkin tag serialization. - Serialize byte slices as JSON arrays of byte values instead of base64 text. - Add a regression test for Zipkin byte slice serialization. --------- Co-authored-by: Robert Pająk <pellared@hotmail.com>
Shared
Code under this directory contains reusable internal code which is distributed across packages using //go:generate gotmpl in gen.go files.