Browse Source

deduplicate same value annotation

Mitsuhiro Tanda 6 years ago
parent
commit
e1a2b258af
1 changed files with 5 additions and 0 deletions
  1. 5 0
      public/app/plugins/datasource/prometheus/datasource.ts

+ 5 - 0
public/app/plugins/datasource/prometheus/datasource.ts

@@ -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;