How govuk-pay/paas-grafana-annotation-resource works
This repository implements a Concourse resource for creating and updating Grafana dashboard annotations. The main workflow is a Concourse put request routed through the out command: it validates configuration, combines tags and template values, then creates a point annotation or updates it into a timed region. The resource also exposes check and in protocol commands; in persists the supplied version ID locally. Edges reflect the command calls and HTTP/file operations shown in excerpts, with the README documenting the Concourse workflow and region behavior.
Main entry points: out.go Out dispatcher · check/main.go Check command · in/main.go In command · out/main.go Out command
Components 14
Concourse Protocol
- Check command
cmd/check/main.go - Version check
pkg/check/check.go - In command
cmd/in/main.go - Version input
pkg/in/in.go - Out command
cmd/out/main.go
Annotation Lifecycle
- Out dispatcher
pkg/out/out.go - Create annotation
pkg/out/out.go - Update annotation
pkg/out/out.go - Tag handling
pkg/tags/tags.go - Version ID file
pkg/out/out.go
Shared Resource Data
- Protocol and API types
pkg/types/types.go - Source validation
pkg/types/resource_source.go
Other components
- Concourse pipeline
- Grafana API
Connections 19
- Concourse pipeline → Check command: sends check
README.md - Concourse pipeline → In command: sends in
README.md - Concourse pipeline → Out command: sends put
README.md - Check command → Version check: calls
cmd/check/main.go - In command → Version input: calls
cmd/in/main.go - Out command → Out dispatcher: calls
cmd/out/main.go - Check command → Protocol and API types: decodes request
cmd/check/main.go - In command → Protocol and API types: decodes request
cmd/in/main.go - Out command → Protocol and API types: decodes request
cmd/out/main.go - Version input → Version ID file: writes ID
pkg/in/in.go - Out dispatcher → Source validation: validates source
pkg/out/out.go - Out dispatcher → Create annotation: dispatches create
pkg/out/out.go - Out dispatcher → Update annotation: dispatches update
pkg/out/out.go - Create annotation → Tag handling: combines tags
pkg/out/out.go - Update annotation → Tag handling: combines tags
pkg/out/out.go - Create annotation → Grafana API: POST annotation
pkg/out/out.go - Update annotation → Grafana API: PATCH annotation
pkg/out/out.go - Create annotation → Version ID file: writes ID
pkg/out/out.go - Update annotation → Version ID file: reads ID
pkg/out/out.go