InfluxDB: InfluxQL: adds tags to timeseries data (#36702) (#36757)

* influxdb: influxql: return tags in timeseries

* influxdb: influxql: added tests

(cherry picked from commit 815f9a7557)

Co-authored-by: Gábor Farkas <gabor.farkas@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2021-07-15 16:32:25 +02:00
committed by GitHub
co-authored by Gábor Farkas
parent 964d312501
commit 7f67bc816a
2 changed files with 15 additions and 1 deletions
@@ -51,7 +51,13 @@ export default class InfluxSeries {
}
}
output.push({ target: seriesName, datapoints: datapoints, meta: this.meta, refId: this.refId });
output.push({
target: seriesName,
datapoints: datapoints,
tags: series.tags,
meta: this.meta,
refId: this.refId,
});
}
});
@@ -138,12 +138,20 @@ describe('when generating timeseries from influxdb response', () => {
expect(result[0].datapoints[0][1]).toBe(1431946625000);
expect(result[0].datapoints[1][0]).toBe(12);
expect(result[0].datapoints[1][1]).toBe(1431946626000);
expect(result[0].tags).toMatchObject({
app: 'test',
server: 'server1',
});
expect(result[1].target).toBe('cpu.mean {app: test2, server: server2}');
expect(result[1].datapoints[0][0]).toBe(15);
expect(result[1].datapoints[0][1]).toBe(1431946625000);
expect(result[1].datapoints[1][0]).toBe(16);
expect(result[1].datapoints[1][1]).toBe(1431946626000);
expect(result[1].tags).toMatchObject({
app: 'test2',
server: 'server2',
});
});
});