Skip to content

test(profiling): cover asyncio task stack stitching - #21949

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
taegyunkim/prof-14213-asyncio-task-stack-tests
Nov 20, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
taegyunkim/prof-14213-asyncio-task-stack-tests

Conversation

@taegyunkim

@taegyunkim taegyunkim commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds regression tests for two task stack properties the profiler already handles on main:

  • A suspended task doesn't pick up frames from a sibling task running on the same thread.
  • Running task stacks under uvloop.run don't include its wrapper frame.

These guard upcoming changes to task stack collection in #19085, where earlier revisions broke both.

Testing

The new tests in tests/profiling/collector/test_asyncio_task_stacks.py pass on main with CPython 3.12 and uvloop. The uvloop test skips when uvloop isn't installed.

Risks

None. Test-only.

Additional Notes

No release note because this only adds tests. JIRA: PROF-14213.

Add regression tests for task stacks: a suspended task must not inherit a running sibling's frames, a running parent's sync frames must follow its suspended child's frames, and uvloop.run's wrapper must not appear in running task stacks.
@taegyunkim taegyunkim added changelog/no-changelog A changelog entry is not required for this PR. Profiling Continous Profling labels Nov 19, 2026
@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Codeowners resolved as

Resolved from the full PR diff against main using the target branch CODEOWNERS file.
CODEOWNERS team requests not listed below are not required by the current file set.

tests/profiling/collector/test_asyncio_task_stacks.py                   @DataDog/profiling-python

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Dependency direction analysis

⚠️ Existing dependency direction violations

There are 22 dependency direction violations that already exist on the base branch and have not been changed by this PR.

Show existing violations (showing 5 of 22 highest severity)
ddtrace.internal.tracemethods -×-> ddtrace.trace  (internal-core -> product:tracing, score=103)
ddtrace.llmobs._integrations.bedrock_agents -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=101)
ddtrace.llmobs._integrations.base -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=101)
ddtrace.internal.span_bus -×-> ddtrace._trace.span  (internal-core -> product:tracing, score=35)
ddtrace.llmobs._llmobs -×-> ddtrace._trace.span  (product:llmobs -> product:tracing, score=33)

To see all violations, download the layers-base.json and layers-pr.json artifacts from this CI job and run:

uv run --script scripts/import-analysis/layers.py compare layers-base.json layers-pr.json

Showing a running parent's sync frames under a suspended child is questionable, so don't lock it in here.
@taegyunkim
taegyunkim marked this pull request as ready for review November 19, 2026 22:36
@taegyunkim
taegyunkim requested a review from a team as a code owner November 19, 2026 22:36
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T22:38:07.470832Z 6a36254 Draft marked ready
🔒 Security Review ✅ Completed 2026-11-19T22:39:21.245524Z 6a36254 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@taegyunkim

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-11-19 22:40:36 UTC ℹ️ Start processing command /merge


2026-11-19 22:40:44 UTC ℹ️ MergeQueue: Pull request is not mergeable yet

It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.

  • Run /code blockers to see what is blocking it.
  • Run /remove to cancel it.

2026-11-19 23:01:21 UTC ℹ️ MergeQueue: merge request added to the queue

The expected merge time in main is approximately 60m (p90).


2026-11-19 23:54:08 UTC ❌ MergeQueue: The build pipeline failed for this merge request

Build pipeline has failing jobs for 91335d3:

What to do next?

  • Investigate the failures and when ready, re-add your pull request to the queue!
  • If your PR checks are green, try to rebase/merge. It might be because the CI run is a bit old.
  • Any question, go check the FAQ.

This build will be kept for 3h more. During that period, you can retry the pipeline or the failing jobs and then re-run the same command!
If you want to reset everything, you can cancel your previous command by rerunning it with the -c flag.

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

Both regression checks require captured task stacks, preventing missing profiler samples from silently satisfying the sibling-frame and uvloop-wrapper assertions. No actionable defect was identified.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 6a36254

@taegyunkim

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-11-20 00:41:26 UTC ℹ️ Start processing command /merge


2026-11-20 00:41:30 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 1h (p90).


2026-11-20 01:17:55 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit a0211f2 into main Nov 20, 2026
346 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the taegyunkim/prof-14213-asyncio-task-stack-tests branch November 20, 2026 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/no-changelog A changelog entry is not required for this PR. Profiling Continous Profling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants