Skip to content

refactor(profiling): build all_task_origins outside task_link_map lock - #20764

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 6 commits into
mainfrom
gyuheon0h/task-origins-outside-lock
Oct 8, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 6 commits into
mainfrom
gyuheon0h/task-origins-outside-lock

Conversation

@gyuheon0h

@gyuheon0h gyuheon0h commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

PROF-16175

Description

  • Moves the all_task_origins set construction before the task_link_map_lock_ guard. all_tasks is a local vector that no other thread touches, so no lock is needed to make the set from it.
  • Adds .reserve(all_tasks.size()) so we dont rehash chains during construction

Testing

Risks

Additional Notes

gyuheon0h commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor Author

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Oct 2, 2026 •

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.

No remaining files require a CODEOWNERS review.

@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Circular import analysis

⚠️ Existing circular imports

There are 1 circular imports that already exist on the base branch and have not been changed by this PR.

ddtrace.errortracking._handled_exceptions.bytecode_injector -> ddtrace.errortracking._handled_exceptions.callbacks -> ddtrace.errortracking._handled_exceptions.collector -> ddtrace.errortracking._handled_exceptions.bytecode_reporting -> ddtrace.errortracking._handled_exceptions.bytecode_injector

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Dependency direction analysis

⚠️ Existing dependency direction violations

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

Show existing violations (showing 5 of 191 highest severity)
ddtrace.internal.tracemethods -×-> ddtrace.trace  (internal-core -> product:tracing, score=125)
ddtrace.llmobs._telemetry -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=123)
ddtrace.llmobs._integrations.llama_index -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=123)
ddtrace.internal.ci_visibility.api._base -×-> ddtrace.trace  (product:ci_visibility -> product:tracing, score=123)
ddtrace.internal.test_visibility.api -×-> ddtrace.trace  (product:ci_visibility -> product:tracing, score=123)

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

@datadog-datadog-us1-prod

datadog-datadog-us1-prod Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Tests

✅ All CI checks and tests passed.

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 9a2ff9f | Docs | View more details | Give us feedback!

@gyuheon0h
gyuheon0h force-pushed the gyuheon0h/dedup-task-origins branch from 3dcb04a to b1dc119 Compare October 2, 2026 19:58
@gyuheon0h
gyuheon0h force-pushed the gyuheon0h/task-origins-outside-lock branch 2 times, most recently from 62f795b to c17e89c Compare October 5, 2026 13:49
@gyuheon0h
gyuheon0h force-pushed the gyuheon0h/dedup-task-origins branch from 763f03f to e872e08 Compare October 5, 2026 14:32
@gyuheon0h
gyuheon0h force-pushed the gyuheon0h/task-origins-outside-lock branch from c17e89c to b2b8c21 Compare October 5, 2026 14:32
@gyuheon0h
gyuheon0h marked this pull request as ready for review October 5, 2026 14:46
@gyuheon0h
gyuheon0h requested review from a team as code owners October 5, 2026 14:46
@vlad-scherbich

Copy link
Copy Markdown
Contributor

@gyuheon0h LGTM, but can you add some tests that pass on both main and branch?

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 741d7275e9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@gyuheon0h
gyuheon0h force-pushed the gyuheon0h/task-origins-outside-lock branch from 741d727 to 3f63fe2 Compare October 5, 2026 15:02
@gyuheon0h gyuheon0h changed the title perf(profiling): build all_task_origins outside task_link_map lock refactor(profiling): build all_task_origins outside task_link_map lock Oct 5, 2026
@gyuheon0h
gyuheon0h force-pushed the gyuheon0h/task-origins-outside-lock branch from 3f63fe2 to 1fc6e7a Compare October 5, 2026 15:12

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ff3d8428ce

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@gyuheon0h gyuheon0h added the changelog/no-changelog A changelog entry is not required for this PR. label Oct 5, 2026
@gyuheon0h
gyuheon0h force-pushed the gyuheon0h/dedup-task-origins branch from e872e08 to f8394e8 Compare October 5, 2026 19:07
@gyuheon0h
gyuheon0h force-pushed the gyuheon0h/task-origins-outside-lock branch from ff3d842 to 848d248 Compare October 5, 2026 19:07
The all_task_origins set was built from all_tasks, then cleared and
identically rebuilt for the weak_task_link_map cleanup. Since all_tasks
is immutable within the locked scope, the second construction produces
the same set. Remove the clear+rebuild to eliminate O(N) redundant work
per sample cycle.
all_task_origins is derived entirely from all_tasks, which is a local
vector no other thread touches. Move its construction before the
lock_guard to reduce the time task_link_map_lock_ is held, unblocking
Python threads calling link_tasks/weak_link_tasks during task creation.

Also adds .reserve() to avoid rehash chains during set construction.
@gyuheon0h
gyuheon0h force-pushed the gyuheon0h/dedup-task-origins branch from f8394e8 to b948e25 Compare October 8, 2026 13:03
@gyuheon0h
gyuheon0h force-pushed the gyuheon0h/task-origins-outside-lock branch from 848d248 to 9a2ff9f Compare October 8, 2026 13:04
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@gyuheon0h gyuheon0h added the Profiling Continous Profling label Oct 8, 2026
Base automatically changed from gyuheon0h/dedup-task-origins to main October 8, 2026 14:55
@gyuheon0h

Copy link
Copy Markdown
Contributor Author

/code blockers

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-10-08 14:59:30 UTC ℹ️ Start processing command /code blockers


2026-10-08 14:59:31 UTC ℹ️ Devflow:

Checking merge blockers for #20764...


2026-10-08 14:59:37 UTC ℹ️ Devflow: /code blockers

No merge blockers detected.

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 72230a0 into main Oct 8, 2026
752 of 754 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the gyuheon0h/task-origins-outside-lock branch October 8, 2026 16:00
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.

3 participants