Repository navigation
feat(monitoring): four-dashboard observability suite over metrics, logs and traces - #2046
Conversation
…gs and traces
The single reference dashboard was built when the exporter had a fraction of
today's surface. The fleet now exports ~200 decdn_* series, ships logs to Loki
and traces to Tempo, and runs three nodes in three regions, while the dashboard
covered 25 named series, no logs, no traces and no region view.
monitoring/ gains dashboard-delivery.json (decdn-delivery), dashboard-chain.json
(decdn-chain) and dashboard-node.json (decdn-node) beside a rebuilt
grafana-dashboard.json (decdn-poc-overview, retitled "fleet overview"; uid and
filename unchanged so the ADR, CHANGELOG and runbook links still resolve).
Coverage goes from 25 named series to 207: every serve-refusal reason, the whole
decdn_node_pull_* funnel, all five chain-event watchers, the decdn_iroh_*
transport sub-registry, and node_exporter host panels that join on the same
instance label.
Loki panels parse the daemon's tracing JSON. journald stamps every stdout line
priority info, so Loki's level stream label and detected_level both report info
whatever the event's real severity — `| json lvl="level"` is the only way to see
it. Tempo panels supply the only latency distribution available anywhere in the
stack: the exporter registers no histograms, so histogram_quantile has nothing
to read.
The name gate now sweeps every .yml and .json under monitoring/ instead of two
hard-coded filenames, so a new dashboard is gated the day it lands. Its exported
set had to grow to match: decdn_iroh_* is registered from a live Endpoint and is
absent from Metrics::new(), so every iroh panel would have read as an unexported
name. register_iroh_endpoint is split so the test can register an
EndpointMetrics::default() without standing up a socket — a real check rather
than a prefix waiver.
Four query bugs fixed while rebuilding, three of which made a panel or rule lie:
- DecdnWatcherTaskPanicked could never evaluate. rate() drops __name__, so the
five per-watcher series on a node collapsed to identical label sets and
Prometheus refused the vector; sum by (instance) does not help, because the
duplicate exists before the aggregation runs. Rewritten with label_replace on
the raw selector and an offset subtraction in place of rate().
- DecdnCacheInflightMutexPoisoned could never resolve: a bare `> 0` on a
monotonic counter whose annotation says not to restart.
- DecdnNodeRestarted fired for five minutes after every deploy.
- The cache hit ratio clamped a per-second rate denominator to a floor of 1.0,
understating every node doing under one lookup per second — all of them.
Also: USDC gauges are scaled out of raw 6-decimal base units and carry
currencyUSD; watcher tick-age thresholds move from 600/1800s to 120/180s so the
panel cannot read green while DecdnBlacklistWatcherStalled fires; panels that
aggregate by (instance) carry {{instance}} in the legend instead of emitting one
identically-labelled series per node; every rule gains a component label and,
where docs/runbook.md has a matching section, a runbook_url annotation.
Verified against the live stack rather than by inspection: all 266 Prometheus
targets return data, all 14 Loki and Tempo targets resolve, and the extended gate
was mutation-tested — a typo'd decdn_iroh_sockt_* in a new file fails it.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The new monitoring/dashboard-node.json contains an annotation query that references undefined template variables, which will break the dashboard’s annotations until corrected.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR upgrades deCDN’s operational observability from a single reference dashboard to a four-dashboard Grafana suite spanning metrics, logs (Loki), and traces (Tempo), while also correcting several alert/query behaviors and extending the “selectors are exported” gate so new monitoring files are validated immediately.
Changes:
- Rebuilds the fleet overview dashboard and adds three new focused dashboards (delivery, chain/payments, single-node drilldown) with metrics/logs/traces panels.
- Fixes multiple alert/query correctness issues (notably watcher panic detection, cache mutex poisoning resolution behavior, and restart detection).
- Extends
monitoring_selectors_are_exportedto sweep allmonitoring/*.jsonandmonitoring/*.yml, and expands the exported series set to includedecdn_iroh_*by registeringEndpointMetricsin tests.
File summaries
| File | Description |
|---|---|
| monitoring/prometheus-alerts.yml | Adds component + runbook_url metadata and fixes several alert expressions. |
| monitoring/grafana-dashboard.json | Rebuilds the fleet overview dashboard; adds logs/traces panels and deep-linking. |
| monitoring/dashboard-delivery.json | New dashboard for serve/pull/cache/origin/warming delivery surfaces. |
| monitoring/dashboard-chain.json | New dashboard for chain watchers, registries, payments, and slash-safety signals. |
| monitoring/dashboard-node.json | New single-node drilldown dashboard combining node_exporter + decdn metrics + logs/traces. |
| docs/runbook.md | Updates runbook “Companion assets” to list the 4-dashboard suite and rule metadata conventions. |
| crates/node/src/metrics.rs | Splits iroh metrics registration for testability; expands selector gating to scan monitoring/. |
| CHANGELOG.md | Documents the observability suite addition and the query/alert fixes. |
| adr/appendix-observability.md | Updates observability appendix to reflect the new dashboard suite and gating behavior. |
| .claude/skills/grafana-dashboards/SKILL.md | Adds repo-specific guidance for maintaining the Grafana dashboards and gating rules. |
Review details
- Files reviewed: 9/10 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Coverage reportTotal: 82.97% (was 82.96%, ▲ +0.01%) — 79907/96303 lines
History
|
…the watcher label
Two review findings, both real.
The node drilldown's "Node restarts" annotation carried the fleet selector
(deployment_environment/region/instance) while that dashboard defines only a
single-select $node. Grafana renders an undefined variable literally, so the
query went out as instance=~"$instance" and matched nothing — the annotation
was silently dead. annotations() now takes the dashboard's own scope instead of
assuming the fleet one, and the node board passes {instance=~"$node"}. Audited
all four boards for undefined variables; this was the only one.
DecdnWatcherTaskPanicked extracted `watcher` with `decdn_(.+)_task_panicked_total`,
which captures `slash_watcher`, so the description read "The slash_watcher watcher
task unwound". The regex now ends `_watcher_task_panicked_total` and the label
reads `slash`. Verified against the live series: the five values are blacklist,
fee_shares, settlement, slash, staker_set.
The selector stays broad. Every panic counter today is a watcher's, but a future
one that is not would still fire this rule — with an empty `watcher` label rather
than silence. For a counter whose every non-zero value is a bug, firing with a
thin message beats not firing.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
What
Replaces the single reference dashboard with a four-dashboard suite covering
metrics, logs and traces, fixes four query bugs found by actually running the
queries, and extends the name gate so the new files are covered from day one.
monitoring/grafana-dashboard.jsondecdn-poc-overviewmonitoring/dashboard-delivery.jsondecdn-deliverymonitoring/dashboard-chain.jsondecdn-chainmonitoring/dashboard-node.jsondecdn-nodeCoverage goes from 25 named series to 207.
Why now
All three signals are already live and only one was on a dashboard. The fleet
exports ~200
decdn_*series, ships ~1 GB/day of logs to Loki and traces toTempo; the dashboard showed 25 metrics, no logs, no traces and no region view.
Four bugs this found
Three of these made a panel or a rule lie, and none were visible before something
actually evaluated them:
DecdnWatcherTaskPanickedcould never evaluate.rate()drops__name__, so the five per-watcher series on a node collapse to identicallabel sets and Prometheus refuses the vector outright.
sum by (instance)does not help — the duplicate exists before the aggregation runs. Rewritten
with
label_replaceon the raw selector plus an offset subtraction.DecdnCacheInflightMutexPoisonedcould never resolve — a bare> 0on amonotonic, process-local counter whose own annotation says not to restart.
DecdnNodeRestartedfired for five minutes after every deploy, and acrash-looping node re-entered it continuously instead of escalating.
understating every node doing under one lookup/sec — which is all three.
The query shape to know
rate()andincrease()drop__name__. A family panel written assum by (__name__) (rate({__name__=~"decdn_x_.+_total"}[5m]))does not evaluateat all. So rate panels name each series explicitly — verbose, correct, and it
puts every one of those ~50 names under the gate, where a regex form would scan
as the wildcard token
decdn_x_and be skipped entirely. Instant panels over afamily use
label_replaceon the raw selector, before any operator strips thename.
Gate change
monitoring_selectors_are_exportednow sweeps every.ymland.jsonundermonitoring/rather than two hard-coded filenames, with a floor of 5 files so adirectory rename cannot silently green it.
The exported set it compares against had to grow to match.
decdn_iroh_*(35series) is registered from a live
Endpointand is absent fromMetrics::new().encode(), so every iroh panel would have failed as anunexported name. Rather than add a prefix waiver — the failure message says
explicitly not to —
register_iroh_endpointis split so the test registers anEndpointMetrics::default()without standing up a socket. Those names are nowgenuinely checked.
Verification
Against the live stack, not by inspection:
(
PoolExhausted, bao faults) because no deliveries have happened; the filtersthemselves match over 24h where the events exist.
decdn_iroh_sockt_*in anew file fails it, confirming both the directory sweep and the iroh coverage
are real.
cargo nextest run -p decdn-node metrics— 29/29.cargo clippy --workspace --all-targetsandcargo fmt -- --checkclean.yamllinton the alerts file: 0 errors. (It caught a duplicatecomponentkey my first pass introduced.)
promtoolis not installed locally, so the alerts file was validated by YAMLparse and by the ruler accepting the rules, not by
promtool check rules.Deployed
Dashboards are live in a new deCDN folder on
decdn.grafana.net, and the 18rules are provisioned and reporting
health=ok.Note the rules are Grafana-managed, not Mimir: the Cloud ruler proxy rejects
writes through the stack service account (
400 bad request dataeven for atrivially valid group). The translation is not literal — each expr already
carries its own comparison, so the result set is empty when not firing but the
surviving values are not usable as a threshold (
up == 0fires at value 0). Thecondition therefore counts datapoints rather than testing them, with
noDataState: OKcarrying the not-firing case. That is written up in theappendix.
Follow-ups not in this PR
appendix already specifies
decdn_probe_collection_latency_secondsasplanned.#[instrument]attributes; every span in Tempobelongs to a dependency crate. The trace panels are built against the
operations that will exist.
adr/appendix-observability.md:293-298callsnode_idmandatory on every logevent; it is emitted on two startup lines only.
🤖 Generated with Claude Code