Skip to content

fix: full app profiling for changing worker ids#1192

Open
ferhatelmas wants to merge 1 commit into
masterfrom
ferhat/fix-full-profiling
Open

fix: full app profiling for changing worker ids#1192
ferhatelmas wants to merge 1 commit into
masterfrom
ferhat/fix-full-profiling

Conversation

@ferhatelmas

Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

Worker ids are changing and doesn't start from zero since #1190

What is the new behavior?

Extract ids from management api, application or error message with retry in the desired order.

Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
Copilot AI review requested due to automatic review settings July 2, 2026 12:11
@ferhatelmas ferhatelmas requested a review from a team as a code owner July 2, 2026 12:11

Copilot AI 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.

Pull request overview

This PR fixes whole-app pprof captures when Platformatic Watt worker IDs are no longer dense/zero-based (as seen after wattpm updates), by resolving live worker IDs from more reliable sources and retrying capture when the initial worker set is invalid.

Changes:

  • Enable the Watt management getWorkers operation and prefer it to discover live worker IDs for profiling targets.
  • Enhance runtime selection logic to extract worker IDs from runtime application details (when available) and fall back to count-based IDs only when necessary.
  • Add a retry path in the admin pprof route that parses “worker not found” errors to recover and profile the live worker IDs; expand test coverage accordingly.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
watt.json Enables management getWorkers operation so the app can query live workers for accurate pprof targeting.
src/internal/monitoring/pprof/runtime.ts Adds worker-id normalization + management/runtime/error parsing helpers and updates selection logic to prefer live IDs.
src/internal/monitoring/pprof/runtime.test.ts Adds unit tests for management-based selection, runtime worker-detail parsing, and error-message extraction.
src/http/routes/admin/pprof.ts Adds retry-on-worker-not-found flow for whole-app captures and ensures cleanup on partial start failures.
src/http/routes/admin/pprof.test.ts Adds an integration-style test that validates the retry behavior and resulting merged multipart response.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 28588978488

Coverage increased (+0.09%) to 78.907%

Details

  • Coverage increased (+0.09%) from the base build.
  • Patch coverage: 3 uncovered changes across 1 file (64 of 67 lines covered, 95.52%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
src/internal/monitoring/pprof/runtime.ts 54 51 94.44%
Total (2 files) 67 64 95.52%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 12265
Covered Lines: 10118
Line Coverage: 82.49%
Relevant Branches: 7087
Covered Branches: 5152
Branch Coverage: 72.7%
Branches in Coverage %: Yes
Coverage Strength: 421.03 hits per line

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants