Open mgblackwater opened 9 months ago
This proposal is interesting, but it would be better, IMO, to discuss it at https://github.com/open-telemetry/opentelemetry-specification as adding an additional header and modifying propagation behavior is not .NET specific; it should be made consistent across all language SDKs.
Also, it should be considered if this is an AWS specific issue, or will other vendors wish to customize scope propagation, which is another reason to propose in the Specification repository. To this end, I think tracestate is meant to address this problem; though I don't know if/when it is to be adopted into OTel.
Issue with OpenTelemetry.Extensions.AWS
Context
The AWS X-Ray Propagator automatically attaches the X-Amzn-Trace-Id header to requests, facilitating trace continuity across services. An example header is:
X-Amzn-Trace-Id: Root=1-5759e988-bd862e3fe1be46a994272793;Parent=53995c3f42cd8ad8;Sampled=1
This header, carrying Root trace ID, Parent span ID, and Sampled status, is crucial for linking traces across services. However, when tracing crosses AWS account boundaries, it introduces specific challenges:
Context Loss: Information critical for debugging and optimization, such as response codes, execution times, and URLs, may not be properly captured or associated due to the reliance on Parent span IDs from different AWS accounts.
Inherited Sampling Decision : The downstream service inherits the sampling decision (Sampled) from the upstream service. This can lead to misaligned tracing efforts, where downstream services might either collect too much or too little trace data, based on the upstream's decision.
I propose enhancing the AWSXRayPropagator to support a new feature: accepting a scope parameter. This enhancement entails:
Is this a feature request or a bug?
What is the expected behavior?
The enhancement aims to introduce scoped tracing to the AWSXRayPropagator within
opentelemetry-dotnet-contrib
, leveraging an additionalX-Amzn-Trace-Scope
header. This feature ensures traces are linked only when they share a common scope, improving trace management across AWS accounts managed by different teams.What is the actual behavior?
Without scoped tracing, services across different AWS accounts may inaccurately link traces, leading to incorrect trace information and difficulties in monitoring and debugging across service boundaries.
Expected Enhancement:
If this proposal gains consensus, I am ready to create a PR to implement these changes.