Skip to content

feat(ai): observe the Ollama slot wait by priority and chart its p95 - #2404

Merged
dan-petty merged 3 commits into
mainfrom
feat/815-ollama-slot-wait-metric
Oct 28, 2026
Merged

dan-petty merged 3 commits into
mainfrom
feat/815-ollama-slot-wait-metric

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

A call to Ollama waits in its process for a slot on one of the Ollama nodes. acquire_ollama_slot queues the calls by priority: high first, as_available last. No metric recorded this wait, so a call that queued in the process looked like a slow reply, and nobody could see whether the priority order starves the lower priorities.

acquire_ollama_slot now observes each wait once in the histogram devops_cli_ai_ollama_slot_wait_seconds, labelled by priority (high, normal or as_available) and by outcome (ok once the call holds a slot, timeout when its deadline passes with no slot). A call that finds a free slot observes about 0 s, so the quantiles cover every call. The observation is sent after the call leaves the slot condition, so the export never holds the lock that the other callers wait on. The name includes the pool, because devops_cli_ai_gateway_slot_wait_seconds already records the wait for a gateway slot, which has no priority.

The AI spend dashboard gets the panel "Ollama Slot Wait by Priority (p95)": the 0.95 quantile over the last hour by priority, and the count of calls that asked for a slot. docs/TELEMETRY.md names the histogram and what its wait covers. The lease counts and queue lengths stay off the dashboards: they are the state of one short-lived process.

The new capability llm-slot-wait holds the requirements.

Closes #815

Change: openspec/changes/archive/2026-10-28-815-ollama-slot-wait-metric/

…nd outcome

A call to Ollama queues in the process by priority, and no metric showed the
wait. acquire_ollama_slot now observes each wait once in the histogram
devops_cli_ai_ollama_slot_wait_seconds, labelled by priority and by outcome
(ok or timeout). docs/TELEMETRY.md names the histogram.

Refs #815
…I spend dashboard

The panel "Ollama Slot Wait by Priority (p95)" charts the 0.95 quantile of
devops_cli_ai_ollama_slot_wait_seconds over the last hour by priority, and the
count of calls that asked for a slot.

Refs #815
@dan-petty

Copy link
Copy Markdown
Owner Author

Local checks, run in the worktree before the push (base bb46660c, then rebased onto ad0114f3 with no conflict):

  • uv run devops ci --check --only lint,format,typecheck: lint, format and mypy (py314 strict) pass.
  • uv run devops ci test src/devops_cli/ai/client/network.py src/devops_cli/telemetry/instruments.py src/devops_cli/docs/generator.py k8s/monitoring/dashboards/ai-spend.json: 731 passed.
  • The three new tests in tests/test_ollama_dynamic_leasing.py failed before the change (no observation sent: assert {} == {...}), and pass after it.
  • test_the_dashboards_chart_latency_errors_reviews_and_findings_devops_cli_sends failed before the panel, and passes after it.
  • validate_promql accepts both queries of the new panel.
  • uv run devops docs check: all documentation files are up to date.

Pending a person: after the merge, Argo CD applies ai-spend.json. Run a command that calls Ollama directly, then confirm that the panel "Ollama Slot Wait by Priority (p95)" shows a series for its priority.

Pending a person: review the diff in tuicr (tuicr -r origin/main..HEAD).

@dan-petty
dan-petty marked this pull request as ready for review October 28, 2026 14:13
@dan-petty
dan-petty merged commit ffeeda4 into main Oct 28, 2026
16 checks passed
@dan-petty
dan-petty deleted the feat/815-ollama-slot-wait-metric branch October 28, 2026 14:43
dan-petty pushed a commit that referenced this pull request Oct 28, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.9.0](v0.8.3...v0.9.0)
(2026-10-28)


### Features

* **ai:** observe the Ollama slot wait by priority and chart its p95
([#2404](#2404))
([ffeeda4](ffeeda4))
* **github:** send GitHub request, throttle and GraphQL point metrics,
and show them on the devops-cli dashboard
([#2406](#2406))
([bded64b](bded64b))
* **k8s:** gpu row panels for clock-event reasons, power against the
enforced limit and pcie throughput
([#2409](#2409))
([21f023c](21f023c)),
closes [#821](#821)
* **review:** a review session records its head commit and clean tree,
and says whether it is on merged code
([#2434](#2434))
([8b4ed46](8b4ed46))
* **review:** an issue filed from a review finding carries its
fingerprint, and the review leaves out a finding that an issue already
carries ([#2428](#2428))
([acace03](acace03))
* **review:** the feedback export counts each review subject once and
keeps every human verdict
([#2417](#2417))
([73d1807](73d1807))
* **roadmap:** act as GitHub App devops-roadmap instead of a machine
account ([#2411](#2411))
([d739a47](d739a47)),
closes [#1647](#1647)
* **roadmap:** labels and milestones hold each item's status, priority,
value and effort, and no roadmap job reads or writes the project board
([#2435](#2435))
([84f02a1](84f02a1)),
closes [#2399](#2399)
* **roadmap:** refine investigates open questions with code and web
tools and decides design questions by the best practice
([#2410](#2410))
([890e228](890e228)),
closes [#2398](#2398)
* **telemetry:** count embedding cache lookups and send every metric
through a declared instrument
([#2416](#2416))
([19412fa](19412fa))


### Bug Fixes

* **git:** ignore missing files when measuring directory size during
reclaim ([#2438](#2438))
([4226904](4226904))
* **security:** scan all namespaces with Popeye when no namespace is
given ([#2436](#2436))
([4d5f789](4d5f789))
* **security:** scan_uv_audit runs a uv audit adapter that audits the
lockfile as it is
([#2446](#2446))
([0b2d005](0b2d005)),
closes [#2106](#2106)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
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.

feat(ai): llm slot wait time by priority as a metric

1 participant