feat(supervisor): add prometheus metric for outbound http requests#4350
Conversation
|
WalkthroughThe 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)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
@trigger.dev/build
trigger.dev
@trigger.dev/core
@trigger.dev/python
@trigger.dev/react-hooks
@trigger.dev/redis-worker
@trigger.dev/rsc
@trigger.dev/schema-to-json
@trigger.dev/sdk
commit: |
…ed core changeset
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.outcomeseparates 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 (nostatus) 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:
fetch) - instrumented inline; the response status code is now also included in the failure log (it was previously dropped).SupervisorHttpClient: dequeue, run attempt start/complete, heartbeats, snapshots, continue, suspend, debug-log, connect) - routed through a single instrumentedrequest()helper that reports via an optionalonHttpRequestCompletecallback on the client, which the supervisor wires into the counter + histogram.Low cardinality by design:
nameis 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 templatedroutelabels on the inbound HTTP server.Registered on the existing metrics registry, exposed on
/metricswith no new wiring. Internal-only change (no package release needed), so the changelog note is a single.server-changesentry.