Repository navigation
Description
Context & Rationale
Embedding-cache use is sent twice, both times as single-point gauges:
devops_cli_embedding_cache_hits_totaland_misses_total, per batch (src/devops_cli/ai/rag/embeddings.py:567-568);rag.embedding_cache.hitand.miss, per lookup (src/devops_cli/ai/rag/cache.py:51, 54).
Each command is its own process, so a gauge keeps only the last process's value (src/devops_cli/telemetry/instruments.py:1-7), and no dashboard may query one.
Scope & Deliverables
- Deliverable:
- Add one counter to
INSTRUMENTSfor embedding-cache lookups, labelled by result (hit or miss). - Remove the two duplicated gauge pairs.
- Add a hit-share panel to
devops-cli.json.
- Add one counter to
- Acceptance criteria:
- A batch with 3 hits and 2 misses sends exactly those counts once.
- The panel query passes
tests/test_telemetry_instruments.py, and its series sit insiderate(orincrease(.
- Key questions: Is it counted per lookup or per batch? (proposed) Per text looked up, recorded once at the batch level.
- Constraint: Tests stay offline.
Strategic Alignment
- Milestone: Backlog
- Depends on: feat(cli): devops-cli dashboards chart the metrics the cli sends and the grafana sidecar provisions them #692
Consolidated from #974, #816 (as sub-issues; both stay open)
Problem (added). The gauge pair above is one instance of a wider pattern. tracer.record_metric sends a single-point OTLP gauge, and about 58 call sites in 24 files under src/ call it (rg -n 'record_metric\(' src, 14e5da1). Most use names for counts or durations that are not in INSTRUMENTS, for example devops_cli_vulnerability_lookups_total, ai.gateway.failover_events and devops_cli_subprocess_seconds. In a short-lived process a gauge keeps only the last value. Dashboard queries are already checked by tests, but nothing checks what is emitted, so items fix one or two sites each (this item, #816).
Acceptance criteria (added; the parent's own scope).
- The PR lists every
record_metric(call site and classifies it as a counter, a histogram, a gauge (a true snapshot) or a delete. - Each count or duration becomes an
INSTRUMENTScounter or histogram. True snapshots, such as gateway health, replica counts and cache size, becomeInstrumentKind.GAUGEentries; fix(telemetry): the project velocity dashboard reads the latest snapshot of each gauge, and the project gauges drop the _total suffix #974 adds that kind. Dead names are deleted. -
record_metricis called only fromtelemetry/instruments.emit(). A test fails on any other caller and on any emitted name that is not inINSTRUMENTS. - No dashboard query names a removed gauge, and the existing dashboard tests pass.
- This item's original criteria stay: one embedding-cache lookup counter, the 3-hits/2-misses case and the hit-share panel.
Sub-issues and order.
- fix(telemetry): the project velocity dashboard reads the latest snapshot of each gauge, and the project gauges drop the _total suffix #974 (P2, top of the backlog by owner decision; carries fix(gh): project metrics read every page and fail closed instead of reporting zero #931) adds
InstrumentKind.GAUGEand lands first. - fix(ai): response-cache hits are counted as cached requests #816 (P1, v0.2.29) removes the
devops_cli_llm_cache_*gauges inai/response_cache.py. This sweep leaves those sites to it. - Linked, not sub-issues:
- feat(ai): llm slot wait time by priority as a metric #815 and feat(github): github api request and throttle counters for the devops-cli dashboard #814 add new instruments that already follow the rule. feat(github): github api request and throttle counters for the devops-cli dashboard #814 reads refactor(github): the github session owns transport, ledger, error classes and link pagination #983's session ledger.
- fix(telemetry): delta metrics from one process can reach the collector out of order #792 (exporter ordering) is a different root cause that every counter depends on.
- feat(roadmap): the roadmap job tallies each release's joins, descopes and trims by reason, and reports them in its plan and as gauges #1126 (release-size gauges) adds
InstrumentKind.GAUGEentries after fix(telemetry): the project velocity dashboard reads the latest snapshot of each gauge, and the project gauges drop the _total suffix #974.
Key questions (added).
- Is
record_metricdeleted? (proposed) No.emit()dispatchesInstrumentKind.GAUGEto it, so it becomes private to that path.
Placement. This item stays P3 in the backlog. Its sub-issues keep their own placement, and the roadmap tooling places this item. Effort grows from Low to Medium (24 files).
Update 2026-10-08: refinement
Gauges landed with #1253, so this no longer waits on #974. No llm_cache gauge remains (#816). devops_cli_embedding_cache_size (ai/rag/embeddings.py:739) becomes a declared gauge. (proposed) Delete the module-level record_metric and record_gauge (telemetry/tracer.py:1362, :1372); the test fails on any other caller.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsReady
- StatusShow more project fieldsReady
Activity
docs(openspec): plan the metric instruments change for #817
docs(openspec): archive the metric instruments change for #817