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<AnnotationQueryEditorProps<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<AnnotationQueryEditorProps<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>