Skip to content

[Feature]: Allow configuring XrayPropagator behavior when header lacks sampling decision #522

@Aaron1011

Description

@Aaron1011

Related Problems?

No response

What component are you working with?

opentelemetry-aws

Describe the solution you'd like:

Currently, XrayPropagator sets the flag TRACE_FLAG_DEFERRED if no Sampled attribute is present in the x-amzn-trace-id header:

let mut sampling_decision = TRACE_FLAG_DEFERRED;

If XRayPropagator is used by a service directly behind an AWS Elastic Load Balancer, then the Sampled attribute will not be present (unless the incoming HTTP request already had it set): https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-request-tracing.html. As a result, extracting and setting the parent span context (e.g. using crates like auxm-tracing-opentelemetry) will always result in the root span having sampling disabled.

It would be useful to be able to configure the behavior of XrayPropagator when the Sampled attribute is not present - e.g. always setting the sampler flag, or delegating to a provided Sampler

Considered Alternatives

A TextMapCompositePropagator can be used to configure a custom propagator to run after XrayPropagator, which can adjust the sampled flag on the Context. However, it would be useful to be able to do this directly in XrayPropagator, considering that the default behavior can be incorrect when using an ELB.

Additional Context

No response

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions