Annotations provide a way to mark points in time or time ranges on graphs with rich events from data sources or manual entries. They help correlate metrics with events like deployments, incidents, or business milestones.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/grafana/grafana/llms.txt
Use this file to discover all available pages before exploring further.
What are Annotations?
Annotations appear as vertical lines or shaded regions on graphs, with associated metadata such as:- Title and text: Descriptive information about the event
- Tags: Categorize and filter annotations
- Time range: Either a single point in time or a time region
- Source: Manual entries, alert state changes, or data source queries
Annotations are displayed across all panels in a dashboard that support them, making it easy to correlate events across different metrics.
Creating Manual Annotations
You can create annotations directly from the dashboard UI:- Ctrl+Click (or Cmd+Click on Mac) on a graph panel at the desired time
- Fill in the annotation details:
- Tags: Add searchable tags
- Description: Event details
- Time range: Optionally drag to create a region annotation
- Save the annotation
Using the API
Create annotations programmatically via the HTTP API:Annotation Queries
Annotation queries automatically fetch events from data sources and display them on dashboards.Configuring Annotation Queries
- Go to Dashboard Settings → Annotations
- Click Add annotation query
- Configure the query:
- Name: Display name for the annotation layer
- Data source: Select the source (e.g., Prometheus, Loki, built-in)
- Query: Define the query using the data source’s query language
- Field mappings: Map data source fields to annotation properties
Built-in Grafana Annotations
The built-in Grafana data source provides access to:- Annotations: Manual annotations stored in Grafana’s database
- Alert state history: Automatic annotations from alert state changes
Example: Prometheus Annotation Query
Query Prometheus for deployment events:Field Mapping
Map data source fields to annotation properties:Displaying Annotations
Dashboard-wide Annotations
Annotations configured in dashboard settings appear on all compatible panels:Panel-specific Filtering
Filter which annotations appear on specific panels:Visual Customization
- Color: Set per annotation query or individual annotation
- Tags: Filter displayed annotations by tag
- Visibility: Toggle annotation layers on/off
Querying Annotations
Retrieve annotations programmatically:Alert State History
Grafana automatically creates annotations when alert rules change state:- Alert name and state transition
- Timestamp of state change
- Alert labels as tags
- Automatically color-coded by severity
TypeScript Client Example
Using the annotation API client frompublic/app/features/annotations/api.ts:1:
Best Practices
Use Tags Consistently
Use Tags Consistently
Automate with CI/CD
Automate with CI/CD
Integrate annotation creation into deployment pipelines:
Region Annotations for Incidents
Region Annotations for Incidents
Use region annotations (with
timeEnd) to mark incident duration:- Start time: When the incident began
- End time: When it was resolved
- Tags: Severity level, affected services
Limit Annotation Queries
Limit Annotation Queries
Too many annotation queries can slow down dashboard loading:
- Keep to 3-5 annotation queries per dashboard
- Use specific filters in queries
- Disable queries when not needed
Related Topics
Dashboard Settings
Configure dashboard-wide annotation queries
Alerting
Automatic annotations from alert state changes
Data Sources
Annotation support varies by data source
API Reference
Complete HTTP API documentation