deduplicate same value annotation

This commit is contained in:
Mitsuhiro Tanda 2019-03-21 09:52:26 +09:00
parent 93677f16d3
commit e1a2b258af

View File

@ -354,6 +354,7 @@ export class PrometheusDatasource implements DataSourceApi<PromQuery> {
})
.value();
const dupCheck = {};
for (const value of series.values) {
const valueIsTrue = value[1] === '1'; // e.g. ALERTS
if (valueIsTrue || annotation.useValueForTime) {
@ -365,6 +366,10 @@ export class PrometheusDatasource implements DataSourceApi<PromQuery> {
};
if (annotation.useValueForTime) {
if (dupCheck[value[1]]) {
continue;
}
dupCheck[value[1]] = true;
event['time'] = Math.floor(parseFloat(value[1]));
} else {
event['time'] = Math.floor(parseFloat(value[0])) * 1000;