Skip to content

Commit e35370b

Browse files
Fix label key (#9)
1 parent 6a577a8 commit e35370b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/SqlSeries.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,6 @@ export default class SqlSeries {
148148

149149
this.series.forEach((row) => {
150150
const t = this.formatTimeValue(row[this.timeKey]);
151-
let metricKey: string | null = null;
152-
153-
if (this.labelKeys.length) {
154-
metricKey = this.labelKeys.map((name) => row[name]).join(', ');
155-
}
156151

157152
if (lastTimeStamp < t) {
158153
Object.values<any[]>(metrics).forEach((dataPoints) => {
@@ -163,11 +158,16 @@ export default class SqlSeries {
163158
lastTimeStamp = t;
164159
}
165160

161+
let index = 0;
162+
166163
Object.entries(row).forEach(([key, val]) => {
167164
if (this.timeKey === key || this.labelKeys.includes(key) || !this.dataKeys.includes(key)) {
168165
return;
169166
}
170167

168+
const metricKey = row[this.labelKeys[index]];
169+
index++;
170+
171171
if (Array.isArray(val)) {
172172
val.forEach((arr) => {
173173
this.pushDatapoint(metrics, t, arr[0], arr[1]);

0 commit comments

Comments
 (0)