openzipkin-contrib / zipkin-otel

Reporters and collectors for use in OpenTelemetry
Apache License 2.0
4 stars 2 forks source link

Support Mapping OpenTelemetry Resource Attributes to/from Zipkin Tags #14

Open making opened 6 days ago

making commented 6 days ago

Feature

Currently, the encoder and collector implementations discard OpenTelemetry's Resource Attributes without converting them, except for service.name. Resource Attributes are a commonly used feature in OTLP, and it is expected that they should be mapped to Zipkin tags.

We need to define a mapping rule for converting Resource Attributes to Zipkin tags (e.g., mapping otel.resources.XYZ tag to XYZ attribute).

Rationale

This feature would improve interoperability between OpenTelemetry and Zipkin by preserving important context provided through Resource Attributes. This would be useful for anyone relying on OTLP data when using Zipkin.

Example Scenario

This prevents the loss of server and environment information defined as resource attributes in the Otel SDK when migrating to Brave. In Spring Boot, resource attributes can be defined using the management.opentelemetry.resource-attributes.**** property.

Prior Art

codefromthecrypt commented 6 days ago

my thinking is to make sure we organize code based on semantic conventions, as this topic gets big, and that's how upstream is organized.

So, some sort of interface for conversion then implementations with test in packages named like otel. Only some of these semantics will have zipkin or brave things on the way back, so I wouldn't worry too much about exact parity (like conversion function is perfectly reversable)

https://github.com/open-telemetry/semantic-conventions/tree/main/docs

making commented 5 days ago

some sort of interface for conversion then implementations with test in packages named like otel

For now, on the encoder side, I would like to add an interface that converts tags to resource attributes (which does nothing by default), and on the collector side, I would like to add an interface that converts resource attributes to tags (which adds resource attributes directly to tags by default. A prefix can be specified in the properties). What do you think?

codefromthecrypt commented 5 days ago

I like these being separate vs adding a dependency shared between collector and brave