The Ops alert list showed "PIA VPN tunnel is down on {{ $labels.job }}". The Grafana rule is fine: Grafana renders it as "…down on pia-vpn-transmission". The problem was in cmd_alerts, which took summary/description from the rule-level annotations (raw templates) and only substituted {{ $value }}.
Change (libexec/devdesk-ops.sh)
One active instance: use the annotations Grafana already rendered for that instance.
Several active instances: replace each {{ $labels.X }} with the distinct values across them (a-job, b-job), or ? if none has the label. {{ $value }} still comes from the first instance.
The description gets the same treatment. Before, it was never substituted.
Tested by running cmd_alerts against a fake /api/prometheus/grafana/api/v1/rules:
Case
Result
1 firing
PIA VPN tunnel is down on pia-vpn-transmission / No tun on 10.10.10.54:9101
2 firing + 1 Normal
Down on a-job, b-job (?) value 1.5 / inst i1, i2 (Normal instance excluded)
description only
Only desc for solo
bash -n and shellcheck are clean. The version number is not bumped.
The Ops alert list showed **"PIA VPN tunnel is down on {{ $labels.job }}"**. The Grafana rule is fine: Grafana renders it as "…down on pia-vpn-transmission". The problem was in `cmd_alerts`, which took `summary`/`description` from the **rule-level** annotations (raw templates) and only substituted `{{ $value }}`.
**Change (`libexec/devdesk-ops.sh`)**
- **One active instance:** use the annotations Grafana already rendered for that instance.
- **Several active instances:** replace each `{{ $labels.X }}` with the distinct values across them (`a-job, b-job`), or `?` if none has the label. `{{ $value }}` still comes from the first instance.
- The description gets the same treatment. Before, it was never substituted.
**Tested** by running `cmd_alerts` against a fake `/api/prometheus/grafana/api/v1/rules`:
| Case | Result |
|---|---|
| 1 firing | `PIA VPN tunnel is down on pia-vpn-transmission` / `No tun on 10.10.10.54:9101` |
| 2 firing + 1 Normal | `Down on a-job, b-job (?) value 1.5` / `inst i1, i2` (Normal instance excluded) |
| description only | `Only desc for solo` |
`bash -n` and `shellcheck` are clean. The version number is not bumped.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_012T5EBQfEofzrZbp3aTiMku
The Ops alert list took summary/description from the rule-level
annotations, which are raw Go templates, and only substituted
{{ $value }}. A rule like "PIA VPN tunnel is down on {{ $labels.job }}"
showed the template literally.
- One active instance: use the annotations Grafana already rendered for it.
- Several: fill each {{ $labels.X }} with the distinct values across the
active instances ("a-job, b-job"), "?" if none has the label.
- The description gets the same treatment (it was never substituted).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012T5EBQfEofzrZbp3aTiMku
All checks were successful
build-deb / Lint, test, package (pull_request) Successful in 3m56s
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The Ops alert list showed "PIA VPN tunnel is down on {{ $labels.job }}". The Grafana rule is fine: Grafana renders it as "…down on pia-vpn-transmission". The problem was in
cmd_alerts, which tooksummary/descriptionfrom the rule-level annotations (raw templates) and only substituted{{ $value }}.Change (
libexec/devdesk-ops.sh){{ $labels.X }}with the distinct values across them (a-job, b-job), or?if none has the label.{{ $value }}still comes from the first instance.Tested by running
cmd_alertsagainst a fake/api/prometheus/grafana/api/v1/rules:PIA VPN tunnel is down on pia-vpn-transmission/No tun on 10.10.10.54:9101Down on a-job, b-job (?) value 1.5/inst i1, i2(Normal instance excluded)Only desc for solobash -nandshellcheckare clean. The version number is not bumped.🤖 Generated with Claude Code
https://claude.ai/code/session_012T5EBQfEofzrZbp3aTiMku
The Ops alert list took summary/description from the rule-level annotations, which are raw Go templates, and only substituted {{ $value }}. A rule like "PIA VPN tunnel is down on {{ $labels.job }}" showed the template literally. - One active instance: use the annotations Grafana already rendered for it. - Several: fill each {{ $labels.X }} with the distinct values across the active instances ("a-job, b-job"), "?" if none has the label. - The description gets the same treatment (it was never substituted). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012T5EBQfEofzrZbp3aTiMkuView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.