Skip to content

[FEATURE]: Support DD_TRACE_PROPAGATION_EXTRACT_FIRST #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sdwa0 opened this issue Feb 28, 2025 · 2 comments
Open

[FEATURE]: Support DD_TRACE_PROPAGATION_EXTRACT_FIRST #190

sdwa0 opened this issue Feb 28, 2025 · 2 comments

Comments

@sdwa0
Copy link

sdwa0 commented Feb 28, 2025

Describe the goal of the feature

dd-trace-cpp doesn’t currently support DD_TRACE_PROPAGATION_EXTRACT_FIRST environment variable to configure the context extraction logic to stop when a valid one is found. Other dd-trace libraries support it.

Is there a particular reason it is not supported in dd-trace-cpp? Is there a plan to support it in dd-trace-cpp for consistency with other tracing libraries?

Is your feature request related to a problem?

The current context extraction logic takes the W3C headers into account regardless of the order of the propagation styles. So there is no way to configure it to prioritize other propagation styles e.g. Datadog over W3C.

Describe alternatives you've considered

No response

Additional context

No response

@sdwa0
Copy link
Author

sdwa0 commented Mar 3, 2025

@dmehala @dgoffredo Apologies for the direct mention. Wanted to know your thoughts on this.

@dmehala
Copy link
Collaborator

dmehala commented Mar 4, 2025

Hi @sdwa0,

No worries about the direct mention. I just wanted to note that David has left the company, I know he's more than willing to help but I'd like to respect his time.

Thank you for bringing up this discrepancy with dd-trace-cpp. To my knowledge, there isn’t a specific reason why DD_TRACE_PROPAGATION_EXTRACT_FIRST isn’t supported, it seems to be more of a coverage gap. For context, this environment variable was introduced for performance reasons when multiple tracing contexts could be extracted.

By default, context extraction follows the Datadog, tracecontext order. This means that Datadog headers are extracted first, followed by W3C tracecontext headers. If the tracing contexts from both match, the context is enhanced with additional W3C information. If they don’t match, the behavior differs slightly, though I don’t have the full details at the moment.

That said, I am not against implementing DD_TRACE_PROPAGATION_EXTRACT_FIRST but I’d love to understand more about the issue you're encountering. That's probably hiding a bigger issue. Could you share what specific challenge led you to need DD_TRACE_PROPAGATION_EXTRACT_FIRST?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants