opentelemetry-specification
opentelemetry-specification copied to clipboard
Clarify precedence of attributes when exporting to non-OTLP formats
The specification does not tell what happens when exporting to a format that is not capable of representing attributes separately for the Resource, for the Scope and for Span/Metric/LogRecord.
The exporter implementations have to flatten to one list of attributes and when the same attribute is present in the Resource, in the Scope and/or in the Span/Metric/LogRecord the implementation must make a decision about which attribute value takes precedence.
Existing implementations in Collector, for example Zipkin exporter make this decision on their own (in Zipkin exporter Span attributes have precedence over Resource attributes when converting to Zipkin tags).
I think we need to define this behavior in the specification to make it consistent for all such exporters.
This came up when discussing the precedence of Scope attributes in the OTEP.
Since scope attributes are now part of the spec, we should probably include them in this effort.
Since scope attributes are now part of the spec, we should probably include them in this effort.
I updated the description to also include the Scope attributes.
- If scope attributes describe only scope and span attributes describe the span, then the attributes cannot be overridden when flattening.
- if we want to support overriding attributes, it should not be done only when exporting to non-OTLP destinations but should apply as a general concept for OTLP destinations as well. This will ensure consistency across OTLP and non-OTLP destinations.