Closed jamestelfer closed 3 years ago
I'm not 100% certain that this header is being sent by the JS API BTW. It might be, but I haven't yet confirmed it.
@jamestelfer you're right, even in the JS tracer, it seems like x-datadog-sampling-priority
may not always be there.
But in the Lambda library, we're not treating it as optional.
If the sampling priority is not set, the traces get sampled out. I'm not sure why this is the case but perhaps we should set the sampling priority to a default if it's not present (or not send it altogether).
cc @Hesperide @DarcyRaynerDD
Expected Behavior
The
x-datadog-sampling-priority
header should (?) be optional; cross-service traces and X-ray merging should still work when this header is missing.The ddtrace library header injector treats the field as optional, so it may not always be present: https://github.com/DataDog/dd-trace-go/blob/v1/ddtrace/tracer/textmap.go#L225-L227
I came across this behaviour when there was an intermediate service whose runtime doesn't have a first-party library. The traceID and parentID headers were forwarded, seemingly satisfying the requirements of the ddtrace-go library's extractor, but this library implements its own behaviour as part of support for Xray trace merging.
Actual Behavior
If the
x-datadog-trace-id
andx-datadog-parent-id
headers are present, but thex-datadog-sampling-priority
header is missing, the trace context is not propagated and the traces aren't joined in the Datadog interface.Specifications