From d4172030c2b77af89bfe461f7afa8f01544fdd16 Mon Sep 17 00:00:00 2001 From: Ifat Afek Date: Thu, 8 Nov 2018 11:13:59 +0200 Subject: [PATCH] Bugfix: return the correct start/end timestamp in Prometheus datasource Change-Id: Ie7d0b3606c9c835d459bda96b9fb455dfa4e0f05 Depends-On: I78b9d21c0a61833967810cd98c2026f69e8f00f6 --- vitrage/datasources/prometheus/properties.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vitrage/datasources/prometheus/properties.py b/vitrage/datasources/prometheus/properties.py index 228df5f61..95d6b03c5 100644 --- a/vitrage/datasources/prometheus/properties.py +++ b/vitrage/datasources/prometheus/properties.py @@ -42,9 +42,10 @@ class PrometheusLabels(object): def get_alarm_update_time(alarm): - return alarm.get(PrometheusAlertProperties.ENDS_AT) if \ - PrometheusAlertProperties.ENDS_AT in alarm else \ - alarm.get(PrometheusAlertProperties.STARTS_AT) + if PrometheusAlertStatus.FIRING == alarm.get(PrometheusProperties.STATUS): + return alarm.get(PrometheusAlertProperties.STARTS_AT) + else: + return alarm.get(PrometheusAlertProperties.ENDS_AT) def get_annotation(alarm, annotation):