Repository navigation
Description
Context & Rationale
devops-cli already ships two dashboards for itself, k8s/monitoring/dashboards/devops-cli.json and ai-spend.json. It also ships the devops grafana dashboards commands list, export, import, sync and lint (src/devops_cli/commands/grafana.py:81, 120, 165, 226, 308).
devops-cli sends eight delta counters and histograms, called INSTRUMENTS (src/devops_cli/telemetry/instruments.py:96-105). Only these may appear in a dashboard query (instruments.py:5-6). The collector's deltatocumulative processor adds each series' deltas up before Prometheus stores them (k8s/otel/values.yaml:58-62, 79-84).
Everything else devops-cli sends is a single-point gauge, sent through record_metric (src/devops_cli/telemetry/tracer.py:909-925). Examples:
devops_cli_subcommand_seconds(src/devops_cli/core/cli.py:26-71)cli.command.total(core/command_decorator.py:24-51)devops_cli_embedding_cache_hits_total(ai/rag/embeddings.py:567-568)devops_cli_llm_cache_hits(ai/response_cache.py:217, 232)
Each command runs as its own short-lived process, so a gauge holds only the last process's value and can't be added up across runs. No dashboard reads one.
Measured against that code:
-
Sent but never charted.
- Every command run sends
devops_cli_command_duration_seconds(src/devops_cli/main.py:141, 157, 175), except--help(main.py:91-97) and global--dry-run(core/cli.py:129-134). No panel reads it. - The
statuslabel ondevops_cli_command_total(main.py:133-140) is never charted. - The
severitylabel ondevops_cli_findings_total(src/devops_cli/ai/review/runner.py:2000-2007) is never charted. - Review volume by
target_type(devops_cli_review_duration_seconds_count,runner.py:1999) is never charted. - Review time and RAG time are histograms (
instruments.py:43-45), but the dashboard shows only their means (devops-cli.json:59, 82).
- Every command run sends
-
"Lifetime" totals aren't lifetime totals. Seven panels sum a raw counter:
- in
devops-cli.json: "Findings by Persona", "Findings by Status" and "Total Lifetime AI Spend" (devops-cli.json:112, 135, 178); - in
ai-spend.json: "Total Lifetime Spend", "Total AI Requests", "Total Tokens Processed" and "Cumulative Spend by Backend Server" (ai-spend.json:82, 129, 176, 324).
A series that sits idle for an hour starts again from zero (
k8s/otel/values.yaml:58-62). These panels therefore show the count since the last reset. - in
-
devops-cli's own dashboards are never provisioned.
- Only the four
k8s-views-*dashboards are packaged for the Grafana sidecar. They sit in two hand-made ConfigMaps (k8s/monitoring/k8s-global-dashboards-configmap.yaml,k8s-node-dashboards-configmap.yaml, 395 KB together). Each value matches its JSON file except for the file's trailing newline. Both ConfigMaps carry three labels:grafana_dashboard,app.kubernetes.io/nameandapp.kubernetes.io/part-of(k8s-global-dashboards-configmap.yaml:6-9). - Only
k8s/monitoring/kustomization.yaml:8-9lists those ConfigMaps, and nothing applies that file.devops k8s deploy-stackrunskubectl apply -k <k8s_dir>on the root kustomization, which holds only namespaces, cloudflared and registry (k8s/kustomization.yaml:4-7;src/devops_cli/commands/k8s/stack_lifecycle.py:740). It also runskubectl apply -fon_MANIFESTS_BY_STACK(stack_lifecycle.py:130-146, 531-535). The ArgoCD path is broken too (feat(k8s): argo cd keeps the homelab cluster at the current release branch, with automated sync, prune and self-heal that never delete data #755). devops-cli.jsonandai-spend.jsonreach Grafana only when someone runsdevops grafana dashboards syncwith a token.
- Only the four
-
synchides failures. When a file fails,syncprints an error and moves on. At the end it prints "completed" and exits 0 (grafana.py:274-281), so a run in which every file failed looks like a success. -
lintchecks one file at a time (grafana.py:344). It reports a missing uid (src/devops_cli/grafana/linter.py:30-38), but two files with the same uid overwrite each other in Grafana without any warning.lint --jsonalso returns before the error check (grafana.py:346-347, against the exit at:369), so it exits 0 whatever it finds.
Most of the requested portfolio has no data source (see Key question 1), so this item is cut to the slice the code can feed today.
Scope & Deliverables
- Deliverable:
- New and changed panels in
devops-cli.json. Each new time series uses a 1h window (Key question 4).- Command latency p50, p95 and p99 by command:
histogram_quantile(q, sum by (le, command) (increase(devops_cli_command_duration_seconds_bucket[1h]))). - Error share by command:
sum by (command) (increase(devops_cli_command_total{status="error"}[1h])) / sum by (command) (increase(devops_cli_command_total[1h])). - Review volume by
target_type(branch, pr or path,runner.py:2017):sum by (target_type) (increase(devops_cli_review_duration_seconds_count[1h])). - Findings by severity as a stacked time series:
sum by (severity) (increase(devops_cli_findings_total[1h])). - "AI Review Duration" (
devops-cli.json:54-59) becomes review p50 and p95 bytarget_type, overdevops_cli_review_duration_seconds_bucket. - "RAG Query Latency" (
:77-82) becomes RAG p50 and p95, overdevops_cli_rag_query_duration_ms_bucket. - Both rebuilt panels keep their place on the grid.
- Command latency p50, p95 and p99 by command:
- The seven raw-counter panels listed above change in two ways.
- The four stat totals become
increase(...[$__range])and are retitled "in range" instead of "lifetime". - The three time series become per-hour
increase(...[1h]).
- The four stat totals become
- Panel descriptions. Every new or changed panel states the limits listed under Constraint.
- Provisioning.
- A new
k8s/monitoring/dashboards/kustomization.yamlhas aconfigMapGenerator:- in namespace
monitoring, withdisableNameSuffixHash: true; - carrying the same three labels as today's ConfigMaps:
grafana_dashboard: "1",app.kubernetes.io/name: grafanaandapp.kubernetes.io/part-of: devops-cli-stack.
- in namespace
- It generates
grafana-k8s-global-dashboards(k8s-views-global, k8s-views-pods) andgrafana-k8s-node-dashboards(k8s-views-nodes, k8s-views-namespaces), with the same names and groupings as today. It adds a newgrafana-devops-cli-dashboards(devops-cli, ai-spend). - The two hand-copied ConfigMap YAMLs are deleted, and
k8s/monitoring/kustomization.yamllistsdashboardsin their place. - The root
k8s/kustomization.yamllistsmonitoring/dashboards. deploy-stack's existingkubectl apply -k <k8s_dir>step (stack_lifecycle.py:740) then applies the ConfigMaps in the same run that creates themonitoringnamespace (k8s/namespaces.yaml:14-22). Teardown already removes them, bydelete -kforallor by deleting the namespace forinfra(stack_lifecycle.py:810-835). No deploy-stack code changes (Key question 8).
- A new
devops grafana dashboards sync.- It still tries every file, and exits 1 if any file failed.
- A dashboard that Grafana refuses to overwrite because it is provisioned counts as skipped, not failed. When a post fails with HTTP 400,
syncreadsGET /api/dashboards/uid/<uid>. Ifmeta.provisionedis true, it reports the file as skipped. - The summary line gives the synced, skipped and failed counts. It exits 0 when the only files not synced were skipped.
devops grafana dashboards lint.- When two dashboards in the set being checked share a uid, each file's report gets an error that names the other file.
lint --jsonexits 1 when any report has an error, as the table output already does.
- Docs and records.
- In
k8s/README.md, themonitoring/subtree (k8s/README.md:249-253) is rewritten to match the directory after this change, includingdashboards/and itskustomization.yaml. - A short section says how dashboards reach Grafana: the sidecar label for the six provisioned files, and
syncfor the rest. - The two vLLM lines in the tree (
k8s/README.md:267-268) are deleted. vLLM was removed in ea49d6e (v0.2.23), andk8s/llm/vllm/doesn't exist. The GPU-placement section at:120-126belongs to fix(k8s): deploy-stack applies the llm gateway policy and narrows its egress #795. - The ROADMAP entry (
docs/ROADMAP.md:655-664) and the task file are rewritten to this scope at Priority P2 (Key question 16). - CHANGELOG gets an
[Unreleased]entry, anddevops docs generate --sync-readmeis re-run.
- In
- New and changed panels in
- Acceptance criteria:
test_every_dashboard_query_names_a_metric_devops_cli_sends(tests/test_telemetry_instruments.py:47-58) gets its list of files by globbingk8s/monitoring/dashboards/*.jsonand keeping each file with adevops_cli_query. Today that selects exactlydevops-cli.jsonandai-spend.json, and both pass with the new panels.- A test checks the series named in
devops-cli.jsonandai-spend.json. These are each instrument'sseries: the counter names and each histogram's_bucket,_sumand_count. Wherever one appears, it is the first argument ofrate(orincrease(. - A test asserts that each of these appears in a panel query:
devops_cli_command_duration_seconds_bucketdevops_cli_command_total{status="error"}devops_cli_review_duration_seconds_count, grouped bytarget_typedevops_cli_review_duration_seconds_bucketdevops_cli_findings_total, grouped byseveritydevops_cli_rag_query_duration_ms_bucket
devops grafana dashboards lint k8s/monitoring/dashboardsreports 0 errors, andtests/test_grafana_dashboards.py:195still passes.- A test parses
k8s/monitoring/dashboards/kustomization.yamlin Python, without kustomize. It checks that:- the generator produces the three named ConfigMaps from exactly the six files above;
- each is in namespace
monitoringwith the three labels; - every other
*.jsonin the directory isllm-stack.jsonorotel-collector.json, so a new dashboard can't be left out by accident; - each generated ConfigMap object, serialised as compact JSON, is under 262,144 bytes. That is how kubectl's last-applied annotation stores it, and 262,144 bytes is the annotation limit f93231b split the views for. The proposed groups measure 166,909, 198,264 and 19,753 bytes today.
- A test asserts that
k8s/kustomization.yamllistsmonitoring/dashboards, and that every resource it lists exists on disk.tests/test_k8s_cloudflared.py:34-35is the precedent. - A reviewer runs
kubectl kustomize k8s/monitoring. The two existing ConfigMaps keep their names and labels, and each data value parses to the same JSON as today.grafana-devops-cli-dashboardsis there too, andkubectl kustomize k8sincludes all three. - Three
synctests:- Against a stub client that fails one post with a 500,
syncexits 1, and the other files are still posted. - Against a stub that answers one post with a 400 and the matching GET with
meta.provisioned: true,syncexits 0 and reports that file as skipped. - When every post succeeds,
syncexits 0, andtests/test_grafana.py:42passes unchanged. Its stub has noget, andgetis called only after a 400.
- Against a stub client that fails one post with a 500,
dashboards linton a temporary directory holding two files with the same uid exits 1 and names both files. With--jsonit also exits 1, and the error appears under both files.uv run devops cipasses.- Manual check, when the cluster is available. Run
devops k8s deploy-stack --stack infra,devops telemetry connectand one command. Thendevops prometheus query 'devops_cli_command_total'returns a series, and Grafana lists "devops-cli Telemetry" and "AI Spend & LLM Usage Telemetry" without anyone runningsync. If the query comes back empty, first suspect the collector's remote-write target (k8s/otel/values.yaml:80, Alloy on port 9090). The repo can't confirm that Alloy listens on that port, and fixing it is a follow-up, not this PR.
- Key questions:
-
Which of the requested dashboards get built? (proposed) None of the four new files (
ai-constellation.json,ai-review.json,github-agentic.json,loki-incident-triage.json). Each asks mostly for data that nothing produces:- Slot leases and priority queues live only in per-process dicts that nothing reads (
src/devops_cli/ai/client/network.py:31-41, 239-248). - The constellation is now only a quiesce flag (adf7d96, feat(telemetry): harness, constellation and telemetry profile report only what actually ran #710).
- TTFT is a span attribute, not a metric (
ai/client/unified.py:758-759). - Vector-cache hits exist only as gauges (
ai/rag/embeddings.py:567-568,ai/rag/cache.py:51, 54), which dashboards may not query. - The LLM response-cache hit share would always read 0, because
cached="true"is never sent:- A cache hit returns at
unified.py:694-696, before_record_response_telemetry_and_spend. That is the only call that passescached=res.cachedtotrack_request_spend(unified.py:441-449). - The stream path and
ai/direct.py:118, 163never pass it (unified.py:836-844).
- A cache hit returns at
- Review classification context is not a metric label (
ai/review/classification.py:121-122). - INVALIDATED findings are dropped before metrics are recorded (
ai/review/pipeline.py:2840-2846). - GitHub quota is kept in a local JSON file (
github/rate_limiter.py:320-345). - devops-cli exports no logs, only
/v1/metricsand/v1/traces(telemetry/tracer.py:890, 1128).
The parts that do have data become panels in the two existing dashboards. The rest are split off.
- Slot leases and priority queues live only in per-process dicts that nothing reads (
-
How are "exit code distributions" charted? (proposed) As
status(ok or error), the only outcome labeldevops_cli_command_totalcarries (main.py:133-140). Exit codes stay on thecli.exit_codespan attribute (main.py:126). -
What about "subcommand invocation frequency"? The
commandlabel holds the top-level group (core/cli.py:123, 139). Per-leaf data exists only as thedevops_cli_subcommand_secondsgauge, keyed by the leaf name (core/cli.py:26-71, 158), and dashboards may not query gauges (instruments.py:5-6). (proposed) Chart by group. Adding a leaf label todevops_cli_command_totalis outside this item. -
What window do the new panels use? (proposed) 1h.
increase()needs two samples of a series inside its window, and devops-cli sends a point only when a command runs (instruments.py:1-7), so a 5m window over a workstation's occasional runs is mostly empty. The existing 5m rate panels (devops-cli.json:201;ai-spend.json:223, 280, 381, 426) stay as they are. -
Is there a severity heatmap? (proposed) No, a stacked time series by severity. Severity is a counter label, not a histogram bucket, so there is nothing to draw as a heatmap.
-
Do the mean panels stay next to the new percentiles? (proposed) No. p50 and p95 replace the means in place, which keeps the panel count and layout.
-
Do dashboards need
${DS_PROMETHEUS}/${DS_LOKI}parameters? (proposed) No. Grafana provisions Prometheus, Loki and Jaeger with the fixed uidsprometheus,lokiandjaeger(k8s/monitoring/grafana-values.yaml:36-59), and the devops dashboards binduid: prometheus. The k8s-views dashboards keep their owndatasourcetemplate variable. -
Where is provisioning applied from? (proposed) From the root kustomization, which deploy-stack already applies with
--k8s-dirhonoured (stack_lifecycle.py:740).- The alternative is a new infra-only
kubectl apply -k <k8s_dir>/monitoring/dashboardsstep. It would need new code, its own dry-run detail and its own--k8s-dirhandling. - One cost of the root route:
--stack llmapplies the ConfigMaps too. That is harmless without Grafana, and that stack already creates every namespace. - deploy-stack does not apply the whole
k8s/monitoringkustomization. It carries a NetworkPolicy and Service aliases that deploy-stack has never applied (k8s/monitoring/kustomization.yaml:5-7). - Fixing the ArgoCD paths stays with feat(k8s): argo cd keeps the homelab cluster at the current release branch, with automated sync, prune and self-heal that never delete data #755.
- The alternative is a new infra-only
-
Why keep the two existing ConfigMap groups instead of one ConfigMap per file? (proposed) With the same names, a re-apply updates them in place. New names would leave the old ConfigMaps behind, and the sidecar would load the same uids twice.
-
Which dashboards are provisioned? (proposed) The four k8s-views,
devops-cli.jsonandai-spend.json. Both of the others stay reachable throughsync:- Not
llm-stack.json: its vLLM panels (llm-stack.json:108-125, 323-340, 349-458) readvllm:*metrics from a removed deployment. feat(k8s): llm gateway, otel collector and prometheus dashboards over metrics the cluster collects (k8s/monitoring/dashboards/) #693 owns that dashboard. - Not
otel-collector.json: itsotelcol_*queries (otel-collector.json:36, 59) need collector self-metrics that nothing scrapes. That is Metrics for the rest of the platform #551.
- Not
-
Should there be a
validatecommand or justlint? (proposed) Keeplint(grafana.py:308) and add no alias, since there are no shims before 1.0. It already checks uid presence, panel ids, grid fit and overlap, PromQL, refIds and datasource binding (linter.py:30-136). This item adds the cross-file uid check and the--jsonexit code. -
Is there a span-waterfall panel? (proposed) No. The linter rejects a target without
expr(linter.py:110).devops telemetry profilealready reads traces back from Jaeger (telemetry/waterfall.py:165), and Grafana's Jaeger datasource is provisioned. -
What happens to "Findings by Persona"? (proposed) It stays, with its query changed to
increase. Until fix(review):review pr --post --no-reportingposts zero findings and metrics lose the persona #791 lands, it puts every finding under the requested persona, or under devsecops by default (runner.py:2084, 2095). This item adds no persona panel, so fix(review):review pr --post --no-reportingposts zero findings and metrics lose the persona #791 is not a dependency. -
How does
synctreat provisioned dashboards?grafana-values.yaml:85-92doesn't setsidecar.dashboards.provider.allowUiUpdates, so the chart default (off) applies. With it off, Grafana refuses an API save over a provisioned uid. Without handling, the new exit-1 rule would make everysyncagainst the stack's Grafana fail. (proposed) Skip bymeta.provisioned, not by matching the error text. Don't turn onallowUiUpdates, because then the ConfigMap and the API would both be sources of truth. -
Does
docs/TELEMETRY.mdchange? (proposed) No. It is generated fromINSTRUMENTS(src/devops_cli/docs/generator.py:884-919, 1007), andtests/test_docs.py:433-442pins its table. This item adds no instrument. -
What Priority does the item have? (proposed) P2 (medium), to match Value Medium. It is a feature, not a Critical fix (
CONTEXT.md:75-77). Three records still say P0 and change in this refinement: thepriority/p0-criticallabel, the ROADMAP heading's "(P0 - Critical)" (docs/ROADMAP.md:655) and the task file's Priority line (docs/agent/tasks/task-692-comprehensive-devops-cli-grafana-observability-dashboard-sui.md:6-7).
-
- Constraint:
- Every new or changed panel reads only series listed in
INSTRUMENTS(instruments.py:96-105). - No panel or ConfigMap covers a removed component: vLLM, LightLLM, Squid or kube-prometheus-stack. The sidecar is configured in
grafana-values.yaml:85-92.prometheus-values.yamlis now the plain Prometheus server chart (prometheus-values.yaml:1-3). - Tests never run kustomize, kubectl, helm or Grafana, and never touch the network.
- Panel descriptions say the values are approximate and undercount sparse series, for three reasons:
increase()needs two samples inside its window, so a series' first sample, and any series seen only once in the window, add nothing.- Delta points from one process can arrive out of order, and totals then come out low (fix(telemetry): delta metrics from one process can reach the collector out of order #792).
review pr --post --no-reportingrecords no findings metric (fix(review):review pr --post --no-reportingposts zero findings and metrics lose the persona #791), so the finding panels miss those runs.
- A quantile past the top bucket comes out as that bucket's bound: 600 s for commands, 7200 s for reviews and 5000 ms for RAG (
instruments.py:43-45). Bucket bounds stay as they are, and each latency panel's description states its cap. - The item is delivered in exactly one PR.
- Every new or changed panel reads only series listed in
Strategic Alignment
- Milestone: v0.2.24
- Depends on: none. feat(k8s): llm gateway, otel collector and prometheus dashboards over metrics the cluster collects (
k8s/monitoring/dashboards/) #693 depends on this item for provisioning: feat(cli): devops-cli dashboards chart the metrics the cli sends and the grafana sidecar provisions them #692 delivers the generator and the deploy route, and feat(k8s): llm gateway, otel collector and prometheus dashboards over metrics the cluster collects (k8s/monitoring/dashboards/) #693 adds its stack dashboards tok8s/monitoring/dashboards/kustomization.yaml. Record that dependency when feat(k8s): llm gateway, otel collector and prometheus dashboards over metrics the cluster collects (k8s/monitoring/dashboards/) #693 is refined. Related:- fix(review):
review pr --post --no-reportingposts zero findings and metrics lose the persona #791 (persona attribution and--no-reportingfindings); - fix(telemetry): delta metrics from one process can reach the collector out of order #792 (out-of-order deltas);
- feat(k8s): argo cd keeps the homelab cluster at the current release branch, with automated sync, prune and self-heal that never delete data #755 (ArgoCD paths);
- Metrics for the rest of the platform #551 (collector and platform scrapes);
- fix(k8s): deploy-stack applies the llm gateway policy and narrows its egress #795 (the README's GPU-placement section and llm deploy paths);
- feat(review): group analysis is profiled as its own stage, and analysis.json counts dispatched, replayed and failed jobs apart #482 (response-cache reporting, which still names vLLM's prefix cache).
- fix(review):
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
[-]feat(cli): comprehensive devops cli grafana observability dashboard suite & gitops provisioner (`devops grafana dashboards sync`)[/-][+]feat(cli): devops-cli dashboards chart the metrics the cli sends and the grafana sidecar provisions them[/+]dan-petty commentedon Oct 1, 2026
The split-offs from this item's refinement are filed: candidate findings by verdict #812, devops-cli logs to Loki #813, GitHub API request and throttle counters #814, LLM slot wait time #815, the response-cache counting defect #816, embedding-cache counters #817, and dropping the kube-prometheus-stack service aliases #818.
dan-petty commentedon Oct 1, 2026
Relabelled from priority/p0-critical to priority/p2-medium, as this item's refinement proposes: it is a feature, not a critical fix. It stays in v0.2.24, which it was already in when the release started.
feat(grafana): devops-cli dashboards chart the metrics the cli sends …
dan-petty commentedon Oct 1, 2026
Closed by #831, merged into
release/v0.2.24.GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by
devops gh issues close-merged.feat(k8s): stack dashboards query only the series their exporters ser…
feat(release): v0.2.24 (#905)
fix(ai): the spend series exists at $0, a gateway call counts as loca…