feat(zebra): add quota-saturation and self-hosted dispatch metrics#1117
feat(zebra): add quota-saturation and self-hosted dispatch metrics#1117loadez wants to merge 2 commits into
Conversation
- tag scheduler.no_capacity with reason (org_ceiling | machine_quota) - emit scheduler.org_utilization gauge (running/max parallelism) per org - split monitor.jobs.pending and .enqueued by cloud vs self-hosted - emit job.dispatching.duration for the self-hosted dispatch path
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 29e494aa21
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| {:ok, updated_job} <- update_job(job, agent) do | ||
| # submit_metrics computes latency from started_at; for the | ||
| # waiting-for-agent case started_at is nil and it is a no-op. | ||
| submit_metrics(updated_job) |
There was a problem hiding this comment.
Emit dispatch metrics after callback starts self-hosted jobs
When the self-hosted service follows the current callback flow (SelfHostedAgent.agent_response/1 returns nil for blank agent info at zebra/lib/zebra/workers/agent/self_hosted_agent.ex:75-80), this new call receives a waiting-for-agent job and submit_metrics/1 no-ops because started_at is nil; the later JobStartedCallbackWorker path (zebra/lib/zebra/workers/job_started_callback_worker.ex:30-41) starts the job without calling Dispatcher.submit_metrics/1. As a result, the self-hosted dispatch metrics added here are missing for the non-legacy SHH path.
Useful? React with 👍 / 👎.
- emit self-hosted dispatch latency under job.dispatching.self_hosted.duration instead of mixing into the untagged, cloud-only job.dispatching.duration - keep the pre-existing total series for monitor.jobs.pending/enqueued and add the cloud/self-hosted split as extra series - report 100% org utilization when the ceiling is 0/unknown with running jobs; harden the guard against a nil ceiling - add tests for utilization and the self-hosted dispatch metrics path
No description provided.