mirror of
https://github.com/grafana/grafana.git
synced 2025-09-22 12:13:15 +08:00
Variables: improve performance of transformMetricFindResponse (#49360)
* improve performance of transformMetricFindResponse * use lodash uniqBy for postgres * use lodash uniqBy for mysql * use lodash uniqBy for mssql * hopefully conform to import linting rules * Added .betterer.results Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com> Co-authored-by: Victor Marin <victor.marin@grafana.com>
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import { uniqBy } from 'lodash';
|
||||
|
||||
import { AnnotationEvent, DataFrame, MetricFindValue } from '@grafana/data';
|
||||
import { BackendDataSourceResponse, FetchResponse, toDataQueryResponse } from '@grafana/runtime';
|
||||
|
||||
@ -29,10 +31,7 @@ export default class ResponseParser {
|
||||
);
|
||||
}
|
||||
|
||||
return Array.from(new Set(values.map((v) => v.text))).map((text) => ({
|
||||
text,
|
||||
value: values.find((v) => v.text === text)?.value,
|
||||
}));
|
||||
return uniqBy(values, 'text');
|
||||
}
|
||||
|
||||
async transformAnnotationResponse(options: any, data: BackendDataSourceResponse): Promise<AnnotationEvent[]> {
|
||||
|
Reference in New Issue
Block a user