Add support for annotation queries
You can add support to your plugin for annotation queries that will insert information into Grafana alerts. This guide explains how to add support for annotation queries to a data source plugin.
Support annotation queries in your data source plugin​
To enable annotations, simply add two lines of code to your plugin. Grafana uses your default query editor for editing annotation queries.
-
Add
"annotations": trueto the plugin.json file to let Grafana know that your plugin supports annotations.src/plugin.json{
"annotations": true
} -
In
datasource.ts, override theannotationsproperty fromDataSourceApi(orDataSourceWithBackendfor backend data sources). For the default behavior, setannotationsto an empty object.src/datasource.tsannotations: {
}