Amazon Managed Service for Prometheus annotations
Annotations overlay event markers on dashboard graphs so you can correlate metrics with events such as deployments or incidents. The Amazon Managed Service for Prometheus data source supports annotations driven by PromQL queries, the same as the core Grafana Prometheus data source.
Before you begin
Before you add annotations, ensure you have:
- Configured the Amazon Managed Service for Prometheus data source.
- A metric in your workspace that marks the events you want to annotate, such as
ALERTSor a custom event metric.
Add an annotation query
To add an annotation query to a dashboard:
- Navigate to Dashboard settings > Annotations.
- Click Add annotation query.
- Enter a name for the annotation.
- Select the Amazon Managed Service for Prometheus data source.
- Enter a PromQL query in the code query field. Any series the query returns becomes an annotation marker.
- Configure the field mappings, then click Apply.
Map query results to annotation fields
Use the following options to control how Grafana builds each annotation from the query results.
Annotation query examples
The following examples show common annotation queries. After you enter a query, use the Title, Text, and Tags fields to format each marker from the series labels.
To create an annotation each time a Prometheus alert fires, query the built-in ALERTS metric:
ALERTS{alertstate="firing"}Set the Title to {{alertname}} and the Text to {{alertstate}} so each marker shows the alert name and state.
To mark when a monitored target goes down, query for targets that report as down:
up == 0Set the Title to {{job}} down and add {{instance}} to the Tags field.
To mark host reboots, query for changes in the node boot time within each step:
changes(node_boot_time_seconds[$__interval]) > 0To place annotations from a metric that stores an event time as its value, such as a deployment timestamp, enable Series value as timestamp:
deployment_timestamp_seconds

