Skip to content

feat(supervisor): add prometheus metric for outbound http requests#4350

Merged
nicktrn merged 4 commits into
mainfrom
feat/supervisor-outbound-request-metrics
Jul 23, 2026
Merged

feat(supervisor): add prometheus metric for outbound http requests#4350
nicktrn merged 4 commits into
mainfrom
feat/supervisor-outbound-request-metrics

Conversation

@nicktrn

@nicktrn nicktrn commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Adds Prometheus metrics so the supervisor's outbound HTTP calls are observable - including client-side failures that previously only surfaced as a log line.

  • supervisor_outbound_request_total{name, method, status, outcome} - counts every outbound request. outcome separates a transport failure (network_error), an HTTP error response (http_error), a response that failed schema validation (invalid_response), and success (ok).
  • supervisor_outbound_request_duration_seconds{name, outcome} - latency histogram. Leaner labels than the counter (no status) to avoid bucket×label cardinality; buckets match the existing dequeue-latency histogram since these calls share the same retrying HTTP client and long-poll envelope.

Coverage:

  • The warm-start request (a one-off fetch) - instrumented inline; the response status code is now also included in the failure log (it was previously dropped).
  • All worker API client calls (SupervisorHttpClient: dequeue, run attempt start/complete, heartbeats, snapshots, continue, suspend, debug-log, connect) - routed through a single instrumented request() helper that reports via an optional onHttpRequestComplete callback on the client, which the supervisor wires into the counter + histogram.

Low cardinality by design: name is a static per-endpoint label (e.g. dequeue, start_run_attempt), never the interpolated URL - so no run/snapshot IDs land in labels, mirroring the templated route labels on the inbound HTTP server.

Registered on the existing metrics registry, exposed on /metrics with no new wiring. Internal-only change (no package release needed), so the changelog note is a single .server-changes entry.

@nicktrn nicktrn self-assigned this Jul 23, 2026
@changeset-bot

changeset-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 1beda66

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The supervisor client now exposes HTTP request completion metrics and routes its HTTP methods through a shared reporting helper. The supervisor application registers labeled Prometheus counter and duration metrics, wires request completion callbacks to update them, and records warm-start HTTP, response-validation, success, and network outcomes. A server-change entry documents the added outbound request observability.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the change, but it omits required template sections like Closes #issue, checklist items, testing steps, and screenshots. Add the missing template sections: Closes #issue, completed checklist, testing steps, changelog, and screenshots or an explicit note that none are needed.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: adding Prometheus metrics for supervisor outbound HTTP requests.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/supervisor-outbound-request-metrics

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nicktrn
nicktrn marked this pull request as ready for review July 23, 2026 15:42
devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@pkg-pr-new

pkg-pr-new Bot commented Jul 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

@trigger.dev/build

npm i https://pkg.pr.new/@trigger.dev/build@1beda66

trigger.dev

npm i https://pkg.pr.new/trigger.dev@1beda66

@trigger.dev/core

npm i https://pkg.pr.new/@trigger.dev/core@1beda66

@trigger.dev/python

npm i https://pkg.pr.new/@trigger.dev/python@1beda66

@trigger.dev/react-hooks

npm i https://pkg.pr.new/@trigger.dev/react-hooks@1beda66

@trigger.dev/redis-worker

npm i https://pkg.pr.new/@trigger.dev/redis-worker@1beda66

@trigger.dev/rsc

npm i https://pkg.pr.new/@trigger.dev/rsc@1beda66

@trigger.dev/schema-to-json

npm i https://pkg.pr.new/@trigger.dev/schema-to-json@1beda66

@trigger.dev/sdk

npm i https://pkg.pr.new/@trigger.dev/sdk@1beda66

commit: 1beda66

devin-ai-integration[bot]

This comment was marked as resolved.

@nicktrn
nicktrn merged commit 722e240 into main Jul 23, 2026
47 checks passed
@nicktrn
nicktrn deleted the feat/supervisor-outbound-request-metrics branch July 23, 2026 17:19
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.

2 participants