[dashboard] Add idle query param to CPU profile endpoints#197
Open
matthewdeng wants to merge 1 commit into
Open
[dashboard] Add idle query param to CPU profile endpoints#197matthewdeng wants to merge 1 commit into
idle query param to CPU profile endpoints#197matthewdeng wants to merge 1 commit into
Conversation
Plumbs an `idle` flag through the `/worker/cpu_profile` and
`/task/cpu_profile` endpoints down to `py-spy record`, which exposes
`--idle` to include stack traces for idle threads. Previously only
`--native` was wired through.
- Adds `optional bool idle` to `CpuProfilingRequest` in reporter.proto
- Threads `idle` through reporter_head -> reporter_agent -> CpuProfilingManager
- Appends `--idle` to the py-spy command when set
- Extends test_profiler_endpoints to parametrize `idle` in {0, 1}
- Refreshes pydoclint baseline
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Adds an
idlequery parameter to the/worker/cpu_profileand/task/cpu_profiledashboard endpoints. It's plumbed down topy-spy record --idle, which includes stack traces for idle threads in the output. Previously only--nativewas wired through.Example:
Related issues
None.
Additional information
Files touched
src/ray/protobuf/reporter.proto— addsoptional bool idle = 5toCpuProfilingRequest.python/ray/dashboard/modules/reporter/reporter_head.py— bothcpu_profileroute handlers readidlefrom the query string and forward it.python/ray/dashboard/modules/reporter/reporter_agent.py—CpuProfilingRPC readsrequest.idleand passes it through.python/ray/dashboard/modules/reporter/profile_manager.py—cpu_profile()acceptsidle: bool = Falseand appends--idleto the py-spy invocation.python/ray/tests/test_dashboard_profiler.py—test_profiler_endpointsnow parametrizesidle∈ {0, 1} on the flamegraph path, mirroring the existingnativeparametrization. No content assertion is added because the busy-loop test actor has no idle threads to verify; the new combinations exercise the wiring (proto field, py-spy flag) and confirm a valid SVG is still returned.ci/lint/pydoclint-baseline.txt— refreshed (one new entry for the updatedReportHead.cpu_profiledocstring; two incidental fixes from cleaner type hints / indentation).Note for reviewers
Because
reporter.protochanged,python/ray/core/generated/reporter_pb2.pywill be regenerated by the build. Locally, run/rebuild(or the equivalent bazel proto target) before exercising the new param.🤖 Generated with Claude Code