Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
AnnotationSupport interface
Since Grafana 7.2
This offers a generic approach to annotation processing
Signature
export interface AnnotationSupport<TQuery extends DataQuery = DataQuery, TAnno = AnnotationQuery<TQuery>>
Import
import { AnnotationSupport } from '@grafana/data';
Properties
Property | Type | Description |
---|---|---|
QueryEditor | ComponentType<QueryEditorProps<any, TQuery>> | Specify a custom QueryEditor for the annotation page. If not specified, the standard one will be used |
Methods
Method | Description |
---|---|
prepareAnnotation(json) | This hook lets you manipulate any existing stored values before running them though the processor. This is particularly helpful when dealing with migrating old formats. ie query as a string vs object |
prepareQuery(anno) | Convert the stored JSON model to a standard datasource query object. This query will be executed in the datasource and the results converted into events. Returning an undefined result will quietly skip query execution |
processEvents(anno, data) | When the standard frame > event processing is insufficient, this allows explicit control of the mappings |
QueryEditor property
Specify a custom QueryEditor for the annotation page. If not specified, the standard one will be used
Signature
QueryEditor?: ComponentType<QueryEditorProps<any, TQuery>>;
prepareAnnotation method
This hook lets you manipulate any existing stored values before running them though the processor. This is particularly helpful when dealing with migrating old formats. ie query as a string vs object
Signature
prepareAnnotation?(json: any): TAnno;
Parameters
Parameter | Type | Description |
---|---|---|
json | any |
Returns:
TAnno
prepareQuery method
Convert the stored JSON model to a standard datasource query object. This query will be executed in the datasource and the results converted into events. Returning an undefined result will quietly skip query execution
Signature
prepareQuery?(anno: TAnno): TQuery | undefined;
Parameters
Parameter | Type | Description |
---|---|---|
anno | TAnno |
Returns:
TQuery | undefined
processEvents method
When the standard frame > event processing is insufficient, this allows explicit control of the mappings
Signature
processEvents?(anno: TAnno, data: DataFrame[]): Observable<AnnotationEvent[] | undefined>;
Parameters
Parameter | Type | Description |
---|---|---|
anno | TAnno | |
data | DataFrame[] |
Returns:
Observable<AnnotationEvent[] | undefined>