mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
deduplicate same value annotation
This commit is contained in:
parent
93677f16d3
commit
e1a2b258af
@ -354,6 +354,7 @@ export class PrometheusDatasource implements DataSourceApi<PromQuery> {
|
|||||||
})
|
})
|
||||||
.value();
|
.value();
|
||||||
|
|
||||||
|
const dupCheck = {};
|
||||||
for (const value of series.values) {
|
for (const value of series.values) {
|
||||||
const valueIsTrue = value[1] === '1'; // e.g. ALERTS
|
const valueIsTrue = value[1] === '1'; // e.g. ALERTS
|
||||||
if (valueIsTrue || annotation.useValueForTime) {
|
if (valueIsTrue || annotation.useValueForTime) {
|
||||||
@ -365,6 +366,10 @@ export class PrometheusDatasource implements DataSourceApi<PromQuery> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (annotation.useValueForTime) {
|
if (annotation.useValueForTime) {
|
||||||
|
if (dupCheck[value[1]]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
dupCheck[value[1]] = true;
|
||||||
event['time'] = Math.floor(parseFloat(value[1]));
|
event['time'] = Math.floor(parseFloat(value[1]));
|
||||||
} else {
|
} else {
|
||||||
event['time'] = Math.floor(parseFloat(value[0])) * 1000;
|
event['time'] = Math.floor(parseFloat(value[0])) * 1000;
|
||||||
|
Loading…
Reference in New Issue
Block a user