First-class support for trace propagation across threads #1202
Labels
core
Involves Datadog core libraries
feature-request
A request for a new feature or change to an existing one
Milestone
We currently support traces that span across multiple threads using the follow pattern:
Despite
parent_span
andthreaded_span
having distinct thread-local contexts, this pattern works because we are manually setting the parent of the first span in the new thread withparent_span
. The two distinct contexts will have their own spans and the backend will eventually stitch them back together into one large trace.We should create an intentionally designed interface to provide threaded tracing. The current "support" is completely manual, and requires understanding of the internals of the tracer.
Ideally, transparent support would be achieved where all threads created from an existing tracing context get associated with the parent trace, but this might not be feasible. Consider the scenario where we spawn long-running threads:
If a tracing context is active when
start_workers
is called, all work performed inside the worker threads will be associated with one very large trace if we have automatic context association.A selective way to enable automatic propagation during the execution of a block could work to address this issue:
These are just suggestions on a possible approach.
The text was updated successfully, but these errors were encountered: