Skip to content

feat(monitoring): scrape the public gateway, with its dashboard and alert rules - #188

Merged
thiras merged 2 commits into
mainfrom
feat/decdn-gateway-monitoring
Oct 31, 2026
Merged

thiras merged 2 commits into
mainfrom
feat/decdn-gateway-monitoring

Conversation

@thiras

@thiras thiras commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Second of three PRs for #176, after #187. It adds metrics, logs, a dashboard and alerts for the public gateway.

Alloy

  • New grafana_alloy_decdn_gateway_enabled toggle, derived from decdn_gateway_hosts in playbooks/group_vars/all.yml, plus _job (decdn-gateway) and _service_name, both validated in preflight.
  • The template scrapes the gateway's loopback metrics listener (127.0.0.1:9094) under its own identity relabel, in both runtimes. The compose branch is wired up in PR 3, so compose/alloy/config.alloy is unchanged here.
  • decdn-gateway.service joins the plain-text units: labelled service_name, re-levelled, and exempt from the priority guardrail. The gateway is the decdn CLI, which logs tracing's plain text.
  • Tests: gatewayonly and colocatedgateway render cases, validate.sh asserts (including the fallback port matching the role default), and three validation-alloy negatives.

monitoring/decdn-gateway/

  • Dashboard dashboard-decdn-gateway.json (uid decdn-gateway), built from the relay dashboard's panels and variables. It shows up, requests and bytes per day, pulls in flight, 503s per day, requests per minute by answer, bandwidth, the 402/503/502 refusals, pointer updates and the log.

  • Rules prometheus-alerts.yml, group decdn-gateway:

    Alert Fires on Severity
    DecdnGatewayDown down, including the relay's absence arm critical
    DecdnGatewayPoolCannotPay any 503 for 5m critical
    DecdnGatewayAllowanceSpent 402s for 15m warning
    DecdnGatewayPullFailures 502 share above 50% warning

    promtool tests cover every rule.

  • exported-metrics.txt, captured from the real decdn 0.3.0 gateway. render-test.sh's exported-name check now runs over both the relay and the gateway, so every decdn_gateway_* name a panel, rule or test uses is checked in CI.

  • render-test.sh also gets promtool check and test for the new directory, the dashboard-uid check, and the package-leak name list with a negative case.

Docs: monitoring/README.md (a section, plus the *Down list), the grafana-dashboards skill, AGENTS.md, and the Alloy and gateway role READMEs. After this merges, publishing the dashboard and rules to the live Grafana folder is decdn/fleet#47's task.

Test plan

  • make lint-alloy: the real pinned Alloy validates every render, including gatewayonly and colocatedgateway. scripts/render-compose-alloy.sh --check reports no change.
  • make molecule SCENARIOS=validation-alloy
  • make lint-helm: promtool check and test for all four rule sets, unique dashboard uids, the gateway names in exported-metrics.txt, the package-leak negative.
  • make lint, make lint-ansible, make test-scripts
  • CI

Refs #176

🤖 Generated with Claude Code

…lert rules

- grafana_alloy: grafana_alloy_decdn_gateway_enabled (from decdn_gateway_hosts),
  _job and _service_name; the gateway's loopback metrics scraped as
  job="decdn-gateway" (both runtimes; Compose wires its profile with the Compose
  PR), its journal stream labelled and re-levelled as plain text. Render cases
  gatewayonly and colocatedgateway, validate.sh asserts, validation-alloy negatives.
- monitoring/decdn-gateway/: a dashboard (uid decdn-gateway: requests by answer,
  bytes, pulls in flight, 402/503/502, pointer updates, logs), rule group
  decdn-gateway (DecdnGatewayDown with the absence arm, DecdnGatewayPoolCannotPay,
  DecdnGatewayAllowanceSpent, DecdnGatewayPullFailures) with promtool tests, and
  exported-metrics.txt captured from decdn 0.3.0. make lint-helm checks the names
  against it, as it does the relay's.

Refs #176

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 30, 2026 23:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The gateway health stat can display a stale green “UP” during an outage because its range query and lastNotNull reducer retain historical healthy samples instead of reflecting current health.

1 open issue

Review effort: Balanced

"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"expr": "up{job=\"decdn-gateway\", instance=~\"$instance\"}",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e3c… — the stat's target is now an instant query, so a host whose agent is gone shows no data rather than a stale UP. (The iroh-relay dashboard's up stat has the same shape; left for a separate change.)

A range query with lastNotNull kept a stale green UP while the host or its agent
was gone (Copilot review on #188).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@thiras
thiras merged commit 914e11b into main Oct 31, 2026
58 checks passed
@thiras
thiras deleted the feat/decdn-gateway-monitoring branch October 31, 2026 00:32
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.

2 participants