Skip to content

feat(telemetry): count embedding cache lookups and send every metric through a declared instrument - #2416

Merged
dan-petty merged 6 commits into
mainfrom
feat/817-metrics-through-instruments
Oct 28, 2026
Merged

dan-petty merged 6 commits into
mainfrom
feat/817-metrics-through-instruments

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Embedding-cache use went out two times, both as single-point gauges. A command is a short-lived process, so a gauge keeps only the value of the last process, and no dashboard could add up the hits and misses. The same fault was in 52 call sites of record_metric, which sent every name as a gauge and outside INSTRUMENTS.

  • devops_cli_embedding_cache_lookups_total counts each text that an embedding request looks up, one time, by result (hit or miss). A hit names its tier (memory or valkey). It replaces the hit, miss and Valkey-hit gauges. devops_cli_embedding_cache_size is a declared gauge.
  • The devops-cli dashboard has the panel "Embedding Cache Hit Share": the hits of the last hour over the lookups of the last hour, 0 for an hour with lookups and no hits.
  • Each other call site sends a declared instrument through emit(): 24 sites are counters, 9 are histograms and 6 are gauges. 13 sites are deleted, because their metric repeats a declared instrument or counts the same data again on a second read (the sandbox log lines and panics, the Falco alerts of a --tail read). The archived design lists each site and its class.
  • The gate wait of devops ci is the histogram devops_cli_ci_gate_slot_wait_seconds. The subprocess and subcommand times are devops_cli_subprocess_duration_seconds and devops_cli_subcommand_duration_seconds, and the chat time is devops_cli_ai_chat_duration_seconds. No dashboard or alert rule read an old name.
  • record_metric and record_gauge (module functions) and the method OTelTelemetryClient.record_metric are deleted. emit() is the one caller of the client's metric methods.
  • A check in tests/test_telemetry_instruments.py reads every module under src/devops_cli/. It fails on a metric that a module writes by name, and on an emit() of an instrument that INSTRUMENTS does not hold. The Prometheus registry of the Service (GLOBAL_METRICS) is a different path, and the check lets it by.
  • CONTRIBUTING.md, docs/TELEMETRY.md and two knowledge-base pages name the new metrics. The knowledge-base pages now say that the metrics go over OTLP to the collector, not to a /metrics endpoint of devops serve.

Closes #817

Change: openspec/changes/archive/2026-10-28-817-metrics-through-instruments/

@dan-petty

Copy link
Copy Markdown
Owner Author

Local results before the push (worktree at the branch head, rebased on origin/main 86d5bce):

  • uv run devops ci test on the telemetry, CI, prewarm, sandbox, structured-output, embeddings and command-coverage tests: 435 passed.
  • uv run devops test run --changed: passed.
  • uv run devops ci test on tests/invariants, the architectural, startup-import, docs-inventory, knowledge-base, semconv and ratchet tests: 205 passed.
  • uv run devops ci --only lint,format,typecheck,constructs --check: lint, typecheck (mypy strict) and constructs pass; format passed after ruff format.
  • uv run devops docs check and uv run devops openspec archive 817-metrics-through-instruments: pass.

Coordination: #2406 (#814) and #2404 (#815) add other instruments and panels. The new panel uses the id 26, clear of the ids 21 to 25 of #2406. Whichever merges second rebases on telemetry/instruments.py and devops-cli.json.

@dan-petty
dan-petty marked this pull request as ready for review October 28, 2026 14:37
@dan-petty
dan-petty enabled auto-merge (squash) October 28, 2026 15:30
@dan-petty
dan-petty force-pushed the feat/817-metrics-through-instruments branch from 8fac2bb to 5c2fa80 Compare October 28, 2026 15:36
@dan-petty
dan-petty merged commit 19412fa into main Oct 28, 2026
16 checks passed
@dan-petty
dan-petty deleted the feat/817-metrics-through-instruments branch October 28, 2026 15:45
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(rag): embedding-cache hits and misses as counters

1 participant