mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 02:10:45 -06:00
Elasticsearch: Deprecate index setting for annotation queries (#67046)
* Elasticsearch: Deprecate index setting for annotation queries * Update comment
This commit is contained in:
parent
efd0e9cbea
commit
0b2f7db224
@ -52,7 +52,7 @@ import {
|
||||
} from './components/QueryEditor/MetricAggregationsEditor/aggregations';
|
||||
import { metricAggregationConfig } from './components/QueryEditor/MetricAggregationsEditor/utils';
|
||||
import { defaultBucketAgg, hasMetricOfType } from './queryDef';
|
||||
import { trackQuery } from './tracking';
|
||||
import { trackAnnotationQuery, trackQuery } from './tracking';
|
||||
import {
|
||||
Logs,
|
||||
BucketAggregation,
|
||||
@ -321,7 +321,8 @@ export class ElasticDatasource
|
||||
ignore_unavailable: true,
|
||||
};
|
||||
|
||||
// old elastic annotations had index specified on them
|
||||
// @deprecated
|
||||
// Field annotation.index is deprecated and will be removed in the future
|
||||
if (annotation.index) {
|
||||
header.index = annotation.index;
|
||||
} else {
|
||||
@ -330,6 +331,7 @@ export class ElasticDatasource
|
||||
|
||||
const payload = JSON.stringify(header) + '\n' + JSON.stringify(data) + '\n';
|
||||
|
||||
trackAnnotationQuery(annotation);
|
||||
return lastValueFrom(
|
||||
this.post('_msearch', payload).pipe(
|
||||
map((res) => {
|
||||
|
@ -140,3 +140,25 @@ export function trackQuery(
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function trackAnnotationQuery(annotation: {
|
||||
target: ElasticsearchQuery;
|
||||
timeField?: string;
|
||||
timeEndField?: string;
|
||||
query?: string;
|
||||
tagsField?: string;
|
||||
textField?: string;
|
||||
index?: string;
|
||||
[key: string]: unknown;
|
||||
}): void {
|
||||
reportInteraction('grafana_elasticsearch_annotation_query_executed', {
|
||||
grafana_version: config.buildInfo.version,
|
||||
has_target_query: !!annotation.target?.query,
|
||||
has_query: !!annotation.query,
|
||||
has_time_field: !!annotation.timeField,
|
||||
has_time_end_field: !!annotation.timeEndField,
|
||||
has_tags_field: !!annotation.tagsField,
|
||||
has_text_field: !!annotation.textField,
|
||||
has_index: !!annotation.index,
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user