SAP HANA annotations
Annotations allow you to overlay event data on your graphs. You can use SAP HANA data to create annotations that mark important events such as deployments, incidents, or other significant occurrences directly on your time-series visualizations.
For more information about annotations in Grafana, refer to Annotate visualizations.
Annotation query requirements
Your annotation query must return at least:
- One time column (timestamp, date, or epoch value) for the annotation’s start time
- One text column for the annotation content
Optionally, include additional columns to enrich your annotations:
- timeEnd: An end time. Return both
timeandtimeEndto create a region annotation that spans a time range. - title: A separate title displayed above the annotation text.
- tags: One or more tags for filtering. Return tags as a comma-separated string to apply multiple tags to a single annotation.
Grafana automatically recognizes columns named time, timeEnd, text, title, and tags. If your columns use different names, map them to the correct annotation fields in the annotation editor.
Create an annotation
To create an annotation using SAP HANA data:
- Open your dashboard and click Dashboard settings (gear icon).
- Select Annotations from the left menu.
- Click Add annotation query.
- Configure the annotation:
- Name: Enter a descriptive name for the annotation.
- Data source: Select your SAP HANA data source.
- Enabled: Toggle on to display the annotation.
- Color: Choose a color for the annotation markers.
- In the Query field, enter a SAP HANA query that returns at least one time field and one text field.
- From the Format as drop-down, select Time Series.
- Configure the From field mappings.
- Click Save dashboard.
Example: Deployment event annotation
The following example creates point annotations from a table containing deployment events:
SELECT
"deployment_time" AS "time",
CONCAT('Deployed version ', "version") AS "text",
"deployed_by" AS "tags"
FROM "deployments"
WHERE $__timeFilter(deployment_time)
ORDER BY "deployment_time" ASCThis query:
- Returns the deployment timestamp as the
timecolumn - Creates annotation text showing the deployed version
- Uses the
deployed_byvalue as a tag for filtering
Example: Region annotation
Return both a time and a timeEnd column to create a region annotation that highlights a span of time, such as an incident window or a maintenance period.
SELECT
"start_time" AS "time",
"end_time" AS "timeEnd",
"incident_name" AS "text",
"severity" AS "tags"
FROM "incidents"
WHERE $__timeFilter(start_time)
ORDER BY "start_time" ASCGrafana shades the area between time and timeEnd on the graph. If a row has no end time, it renders as a single point annotation.
Example: Annotation with a title and multiple tags
Use a separate title column for a bold heading, and return a comma-separated tags column to apply more than one tag to each annotation.
SELECT
"event_time" AS "time",
"event_type" AS "title",
"event_message" AS "text",
CONCAT("environment", ',', "service") AS "tags"
FROM "application_events"
WHERE $__timeFilter(event_time)
ORDER BY "event_time" ASCIn this query, event_type appears as the annotation title, event_message as the body, and the environment and service values become two separate tags.
Annotation display
Annotations appear as vertical markers on your graph panels. Hover over a marker to see the annotation details.
Annotation display options
When configuring annotations, you can customize how they appear:
- Color: Choose distinct colors for different annotation types to differentiate them.
- Show in: Select which panels display the annotation (All panels or specific panels).
- Hide: Temporarily hide annotations without deleting them.
Use template variables in annotations
You can use template variables in your annotation queries to create dynamic annotations that respond to dashboard variable selections.
Example:
SELECT
"event_time" AS "time",
"event_description" AS "text"
FROM "events"
WHERE $__timeFilter(event_time)
AND "environment" = ${environment}
ORDER BY "event_time" ASCThis query filters annotations based on the selected environment variable.


