From 301aa8906b6c7c5ccaa74b74894780d2658e6d08 Mon Sep 17 00:00:00 2001 From: Alex Salt Date: Tue, 28 May 2019 14:57:09 +0300 Subject: [PATCH] /api/v1/rules: alert value as string (#585) Signed-off-by: Alexander Saltykov --- api/prometheus/v1/api.go | 2 +- api/prometheus/v1/api_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/prometheus/v1/api.go b/api/prometheus/v1/api.go index 1ff4402..b98c075 100644 --- a/api/prometheus/v1/api.go +++ b/api/prometheus/v1/api.go @@ -327,7 +327,7 @@ type Alert struct { Annotations model.LabelSet Labels model.LabelSet State AlertState - Value float64 + Value string } // TargetsResult contains the result from querying the targets endpoint. diff --git a/api/prometheus/v1/api_test.go b/api/prometheus/v1/api_test.go index 0e24b49..9a58272 100644 --- a/api/prometheus/v1/api_test.go +++ b/api/prometheus/v1/api_test.go @@ -493,7 +493,7 @@ func TestAPIs(t *testing.T) { "severity": "page", }, "state": "firing", - "value": 1, + "value": "1e+00", }, }, "annotations": map[string]interface{}{ @@ -537,7 +537,7 @@ func TestAPIs(t *testing.T) { "severity": "page", }, State: AlertStateFiring, - Value: 1, + Value: "1e+00", }, }, Annotations: model.LabelSet{