refactor(profiling): split stack sampler helpers#18975
Open
taegyunkim wants to merge 4 commits into
Open
Conversation
Contributor
🎉 All green!🧪 All tests passed 🔗 Commit SHA: 584be28 | Docs | Datadog PR Page | Give us feedback! |
Codeowners resolved as |
Circular import analysis
|
Extract the task/greenlet/normal-stack rendering block out of ThreadInfo::sample into a render_unwound_stacks() free function so the rendering path can be reused by additional callers. Pure refactor: same render order, renderer, and container clears; no behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
9866b28 to
8ac5dd7
Compare
Extract the task/greenlet/normal-stack rendering block out of ThreadInfo::sample into a private ThreadInfo::render_unwound_stacks() method so the rendering path can be reused by additional callers, consistent with the existing unwind_tasks/unwind_greenlets helpers. Pure refactor: same render order, renderer, and container clears; no behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…//github.com/DataDog/dd-trace-py into taegyunkim/prof-14213-stack-sampler-refactor # Conflicts: # ddtrace/internal/datadog/profiling/stack/src/echion/threads.cc
KowalskiThomas
approved these changes
Jul 12, 2026
KowalskiThomas
left a comment
Contributor
There was a problem hiding this comment.
Code changes LGTM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Pure refactor of existing stack sampler internals, with no intended behavior or internal contract changes, in preparation for timer_create based cpu time profiling in #18724
Specifically:
ThreadInfo::sample()into a localrender_unwound_stacks()helper.Sampler::register_thread()into a local helper.This does not introduce CPU timer profiling, new configuration, new native bindings, or changes to thread registration semantics.
Testing
scripts/lint cformatAttempted a targeted profiling test run from the worktree, but the test runner failed during riot venv setup before executing tests due the worktree using
/home/bits/project/.riot, which was not writable/available in that context.Risks
Low. This is intended to be behavior-preserving refactoring only.
Additional Notes
No changelog needed, internal refactor only.