Skip to content

feat(zebra): add quota-saturation and self-hosted dispatch metrics#1117

Open
loadez wants to merge 2 commits into
mainfrom
zebra/quota-saturation-metrics
Open

feat(zebra): add quota-saturation and self-hosted dispatch metrics#1117
loadez wants to merge 2 commits into
mainfrom
zebra/quota-saturation-metrics

Conversation

@loadez

@loadez loadez commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

No description provided.

- 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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread zebra/lib/zebra/workers/dispatcher.ex Outdated
{: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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant