Skip to content
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

DatadogBackend attaches custom attributes to wrong span #429

Closed
1 task
timmc-edx opened this issue Jul 8, 2024 · 1 comment
Closed
1 task

DatadogBackend attaches custom attributes to wrong span #429

timmc-edx opened this issue Jul 8, 2024 · 1 comment

Comments

@timmc-edx
Copy link
Contributor

timmc-edx commented Jul 8, 2024

When we record custom attributes, the intent is to record them on the span representing the current Django request, Celery task, or other service-entry span. Our use of ddtrace.tracer.current_root_span() was intended to implement that, but it turns out this can return a span from outside the current service/process if the trace started in another service.

This could mean that if service A calls service B, attributes meant for the Django request in B are attached to the one in A, possibly overwriting values there.

Acceptance criteria:

  • DatadogBackend.set_attribute attaches to the service entry span, not the trace root span

Implementation notes:

(Note that this compounds with the trace concatenation issue -- attributes get attached to the initial trace that all the others get concatenated to.)

@timmc-edx timmc-edx converted this from a draft issue Jul 8, 2024
@timmc-edx
Copy link
Contributor Author

Closing out -- I think we're actually OK, and the docs are just confusing. I've updated DataDog/dd-trace-py#9758 to be about clarifying the documentation. We can reopen if it turns out I was wrong.

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

1 participant