otel: create migration mechanism to semantic convention attribute names#45184
otel: create migration mechanism to semantic convention attribute names#45184fcfort wants to merge 4 commits into
Conversation
|
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
Signed-off-by: Frank Fort <ffort@google.com>
Signed-off-by: Frank Fort <ffort@google.com>
Signed-off-by: Frank Fort <ffort@google.com>
Signed-off-by: Frank Fort <ffort@google.com>
| message OpenTelemetryConfig { | ||
| enum OtelSemconvStabilityOptIn { | ||
| UNKNOWN = 0; | ||
| LEGACY = 1; |
There was a problem hiding this comment.
Please add a short comment about each enum value (potentially with a link to the places in the OTEL spec they relate to).
| // - ``LEGACY``: Emit only the legacy Envoy attributes. | ||
| // - ``LEGACY_AND_SEMCONV``: Emit BOTH the new stable attributes and the | ||
| // legacy Envoy attributes simultaneously. | ||
| // - ``SEMCONV``: Opt-in to the new stable semantic conventions. Legacy Envoy | ||
| // attribute names are NOT emitted. |
There was a problem hiding this comment.
These need to be in the enum description
| UNKNOWN = 0; | ||
| LEGACY = 1; | ||
| LEGACY_AND_SEMCONV = 2; | ||
| SEMCONV = 3; |
There was a problem hiding this comment.
One thing to consider:
if you think a specific config might be needed for each value (e.g., a specific config knob that is relevant to the semantic-conv option), then it may be better to use a message-type for of these entries instead.
| // - ``LEGACY``: Emit only the legacy Envoy attributes. | ||
| // - ``LEGACY_AND_SEMCONV``: Emit BOTH the new stable attributes and the | ||
| // legacy Envoy attributes simultaneously. | ||
| // - ``SEMCONV``: Opt-in to the new stable semantic conventions. Legacy Envoy |
There was a problem hiding this comment.
Was choosing the enum over bool fields preferred over boolean fields intentional?
The reason for my question: LEGACY_AND_SEMCONV implies that both flags are set. If another new flag is added, then we'll end up with 4 more enum values: NEW, LEGACY_AND_NEW, SEMCONV_AND_NEW, and LEGACY_AND_SEMCONV_AND_NEW.
It may be better to have a different message-type here (which makes this opt-in), and then each of the legacy/semconv as a BoolValue type.
Commit Message: otel: create migration mechanism to semantic convention attribute names
Additional Description:
This change implements the ability to bring Envoy’s OpenTelemetry tracer in alignment with the stable OpenTelemetry HTTP Semantic Conventions.
The architecture avoids adding additional string comparisons at core call sites by utilizing C++ overload resolution within the tracing driver APIs (
setTagoverload for typedTracing::Tag).Stability Opt-In Levels:
UNKNOWN: Defaults to legacy tags only (backward-compatible default behavior).LEGACY: Emits only the legacy Envoy attributes.LEGACY_AND_SEMCONV: Emits BOTH stable OTel and legacy Envoy attributes simultaneously.SEMCONV: Emits only the stable OpenTelemetry HTTP/Network semantic convention attributes.This was loosely inspired by the approach outlined in https://opentelemetry.io/docs/specs/semconv/http/ regarding
OTEL_SEMCONV_STABILITY_OPT_IN.Tag Migration Mapping:
The following table defines the exact mapping of span tags that will be migrated from the legacy Envoy naming conventions to the stable OpenTelemetry HTTP and Network semantic conventions under the respective opt-in levels:
http.methodhttp.request.methodhttp.status_codehttp.response.status_codehttp.urlurl.fullpeer.addressnetwork.peer.addressrequest_sizehttp.request.body.sizeresponse_sizehttp.response.body.sizeretry.counthttp.request.resend_countuser_agentuser_agent.originalNote:
http.protocolis deliberately NOT migrated tourl.schemeor any other semantic convention name because its semantics differ. It is unaffected by the opt-in levels and continues to emit only ashttp.protocol.Risk Level: Low (Adds standardized stability opt-in tags, defaults to backward-compatible legacy behavior).
Testing:
opentelemetry_tracer_impl_test.ccwith the newExportOTLPSpanWithLegacyOptInunit test to validate theLEGACYconfiguration behavior.//test/extensions/tracers/opentelemetry:opentelemetry_test) and affected core tracing and routing tests (//test/common/http:async_client_impl_testand//test/common/router:router_test).Docs Changes: None.
Release Notes: Added
otel_semconv_stability_opt_inconfiguration to support stable HTTP semantic convention attribute names in the OpenTelemetry tracer.Platform Specific Features: None.
Fixes #30821.
[Disclosed usage of generative AI: Yes, used to assist in code modifications.]