Repository navigation
refactor(profiling): centralize span link lifecycle - #20347
taegyunkim wants to merge 1 commit into
Conversation
Codeowners resolved asResolved from the full PR diff against |
Circular import analysis
|
Dependency direction analysis
|
❌ ErrorsYour PR has failed checks. Please review the issues below and take necessary action before merging. 🚦 1 Pipeline job failed
ℹ️ InfoNo other issues found (see more)🧪 All tests passed 🔄 Datadog retried 1 test - 1 passed on retry Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: d92c58d | Docs | View more details | Give us feedback! |
fabbeef to
d92c58d
Compare
|
Closing in favor of #19736, which now bases directly on |
Description
Stacked directly on
main.Centralize profiler span-link routing and lifecycle handling in a runtime-independent Python module. The stack collector now normalizes tracing contexts once, starts and stops span linking with the collector, republishes an already-active span, invalidates inherited state across restarts and forks, and removes every native link derived from a finished span.
This PR also adds the native
reset_span_links()lifecycle operation. It intentionally keeps only physical-thread attribution. Asyncio task storage and task-specific helpers are introduced with their first consumer in #19736, while greenlet storage and greenlet-specific helpers are introduced in #19420.With no runtime-specific provider registered, activations continue to use the existing physical-thread native API. The coordinator remains importable when the optional native stack extension is unavailable.
Testing
scripts/lint checkson the complete rewritten stackscripts/run-tests --venv 1ed51fe -- tests/profiling/collector/test_stack_span_links.py tests/profiling/collector/test_stack_threadpool.py -k 'stack_span_links or link_span_plain_context or link_span_context'Risks
The collector's listener, restart, and fork lifecycle is consolidated. Tests cover context deactivation, inherited context validation, finished spans, fork reset, current-span republishing, and propagated context metadata.
No runtime-specific provider is registered in this PR, so asyncio tasks, AnyIO workers, and gevent greenlets do not change attribution behavior yet.
Additional Notes
No release note is needed because this is an internal refactor with no customer-visible behavior change. The PR keeps the
changelog/no-changeloglabel.Review this stack in order:
The former standalone native infrastructure PR #20346 is superseded by the runtime-specific PRs above.