mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
add annotation option to treat series value as timestamp
This commit is contained in:
@@ -487,15 +487,21 @@ export class PrometheusDatasource {
|
||||
.value();
|
||||
|
||||
for (const value of series.values) {
|
||||
if (value[1] === '1') {
|
||||
const valueIsTrue = value[1] === '1'; // e.g. ALERTS
|
||||
if (valueIsTrue || annotation.useValueForTime) {
|
||||
const event = {
|
||||
annotation: annotation,
|
||||
time: Math.floor(parseFloat(value[0])) * 1000,
|
||||
title: self.resultTransformer.renderTemplate(titleFormat, series.metric),
|
||||
tags: tags,
|
||||
text: self.resultTransformer.renderTemplate(textFormat, series.metric),
|
||||
};
|
||||
|
||||
if (annotation.useValueForTime) {
|
||||
event['time'] = Math.floor(parseFloat(value[1]));
|
||||
} else {
|
||||
event['time'] = Math.floor(parseFloat(value[0])) * 1000;
|
||||
}
|
||||
|
||||
eventList.push(event);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user