Grafana

Show releases and syncs on Grafana dashboards as annotations, which dashboards they appear on, what happens when Grafana is down, and what has only been tested against a fake.

Connect Grafana and Wardn adds an annotation when a release finishes, a sync applies, or a release fails or is rolled back, so you can see a change on the graph it moved. Grafana is a place to show releases, not a source of checks: nothing waits on it, and markers never hold a release.

Wardn has been built and tested against a fake Grafana (an in-process HTTP server that answers like the documented API). No real Grafana was available, so the exact responses of real versions, in particular /api/access-control/user/permissions, have not been confirmed against one. Try Test connection on your Grafana before relying on it.

Connect it

You need integration:manage (Owners and Admins) and a server with WARDN_SECRET_MASTER_KEY set. In Grafana create a service account with the Editor role and a token for it, then connect from Integrations, Grafana, or with the API:

curl -fsS -X PUT "$WARDN_API_URL/api/v1/deploy-markers/grafana" \
  -H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' \
  -d '{"name":"Grafana","url":"https://grafana.example.com","token":"glsa_…"}'

The token is write-only: it is kept in the secret store as integrations/grafana/<connection id>/token, and the API returns only that reference and whether it is found.

Test connection reads the organization (GET /api/org) and who the token is (GET /api/user), then asks whether the token may write annotations without writing one. It reads GET /api/access-control/user/permissions and looks for annotations:create; a Grafana without fine-grained access control, or one that does not let the token read its own permissions, is judged by the token's role in GET /api/user/orgs (Editor or Admin can write). A token that cannot write is refused when connecting with Org acme; the service account cannot write annotations. Give it the Editor role.

The address is checked

The address is typed by a person in your organization, so Wardn treats it as untrusted. It must be https://, with no user name, query or fragment (http:// only where the install allows it for development with WARDN_CONNECTIONS_ALLOW_INSECURE_HTTP). At the moment of connecting, after the name is resolved, Wardn refuses loopback, link-local, unspecified, multicast and cloud-metadata addresses, and on an install that sets WARDN_CONNECTIONS_BLOCK_PRIVATE_ADDRESSES private addresses too, so a connection cannot aim Wardn at the server itself. No redirect is followed, so the token goes only to the host you named.

What is posted

MomentPosted when
Release finishedA release completes; one annotation for each deployment that received it
Sync appliedA sync, not a release, changes a deployment
Release failed or rolled backA release fails, or a rollback completes

Each is a switch, and Environments limits them (none chosen means every environment). The annotation is POST /api/annotations with the time of the moment, text that names the deployment, the release, the seven-character commit and links back to the release in Wardn, and tags: wardn, deploy, env:{environment} and app:{deployment} by default, with {environment}, {deployment}, {sha7} and {release} filled in.

Shown on chooses where it appears:

  • All dashboards in the org posts one organization annotation. Add a Grafana annotation query that filters by the tag wardn to show it on a dashboard.
  • Only dashboards with a tag looks up the dashboards that have the tag (GET /api/search?tag=…, at most 20) and posts an annotation to each by its UID. A tag nobody has posts nothing and the list says no dashboard has the tag ….

Recent markers (GET /api/v1/deploy-markers/grafana/posts, newest first, paged) shows each with what Grafana answered: 200 · annotation 8841, Retried · 200 on 2nd try, or why it was refused, such as 401 · token expired or revoked.

When Grafana is down

Markers are queued and tried again after 30 seconds, a minute, two, five and then every ten minutes, until an hour after the moment, and then dropped. A refusal that waiting cannot fix is not retried. Pause Grafana on the Integrations page (Integration health) to stop posting; markers waiting are posted if you resume within the hour. Disconnect removes the connection and the token; annotations already posted stay in Grafana.

A reply lost after Grafana saved an annotation can post it twice; Grafana has no way to ask for it only once. Connecting, changing the settings and disconnecting are audited; markers themselves are timeline records, not audit entries.

On this page