From 2c646320b55152164ed7a6c410ae9487e2449542 Mon Sep 17 00:00:00 2001 From: yeya24 Date: Wed, 11 Dec 2019 10:08:30 -0500 Subject: [PATCH] fix /api/v1/rules value Signed-off-by: yeya24 --- pkg/rule/api/v1.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/rule/api/v1.go b/pkg/rule/api/v1.go index bacdb5570a..7927a97d67 100644 --- a/pkg/rule/api/v1.go +++ b/pkg/rule/api/v1.go @@ -3,6 +3,7 @@ package v1 import ( "fmt" "net/http" + "strconv" "time" "github.com/NYTimes/gziphandler" @@ -141,7 +142,7 @@ type Alert struct { Annotations labels.Labels `json:"annotations"` State string `json:"state"` ActiveAt *time.Time `json:"activeAt,omitempty"` - Value float64 `json:"value"` + Value string `json:"value"` PartialResponseStrategy string `json:"partial_response_strategy"` } @@ -154,7 +155,7 @@ func rulesAlertsToAPIAlerts(s storepb.PartialResponseStrategy, rulesAlerts []*ru Annotations: ruleAlert.Annotations, State: ruleAlert.State.String(), ActiveAt: &ruleAlert.ActiveAt, - Value: ruleAlert.Value, + Value: strconv.FormatFloat(ruleAlert.Value, 'e', -1, 64), } }