Graphite: Use data frames when procesing annotation query in graphite ds (#20857)

* Use data frames when procesing annotation query in graphite ds

* Remove destruct
This commit is contained in:
Dominik Prokop
2019-12-04 18:07:11 +01:00
committed by Torkel Ödegaard
parent 4c9cb415ec
commit ad33d95dd3
@@ -177,22 +177,24 @@ export class GraphiteDatasource extends DataSourceApi<GraphiteQuery, GraphiteOpt
maxDataPoints: 100, maxDataPoints: 100,
} as unknown) as DataQueryRequest<GraphiteQuery>; } as unknown) as DataQueryRequest<GraphiteQuery>;
return this.query(graphiteQuery).then((result: { data: any[] }) => { return this.query(graphiteQuery).then(result => {
const list = []; const list = [];
for (let i = 0; i < result.data.length; i++) { for (let i = 0; i < result.data.length; i++) {
const target = result.data[i]; const target = result.data[i];
for (let y = 0; y < target.datapoints.length; y++) { for (let y = 0; y < target.length; y++) {
const datapoint = target.datapoints[y]; const time = target.fields[1].values.get(y);
if (!datapoint[0]) { const value = target.fields[0].values.get(y);
if (!value) {
continue; continue;
} }
list.push({ list.push({
annotation: options.annotation, annotation: options.annotation,
time: datapoint[1], time,
title: target.target, title: target.name,
}); });
} }
} }