Skip to content

Commit 4506fb1

Browse files
yeya24bwplotka
authored andcommitted
fix /api/v1/rules value (#1872)
Signed-off-by: yeya24 <yb532204897@gmail.com>
1 parent 51d584e commit 4506fb1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/rule/api/v1.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package v1
33
import (
44
"fmt"
55
"net/http"
6+
"strconv"
67
"time"
78

89
"github.com/NYTimes/gziphandler"
@@ -141,7 +142,7 @@ type Alert struct {
141142
Annotations labels.Labels `json:"annotations"`
142143
State string `json:"state"`
143144
ActiveAt *time.Time `json:"activeAt,omitempty"`
144-
Value float64 `json:"value"`
145+
Value string `json:"value"`
145146
PartialResponseStrategy string `json:"partial_response_strategy"`
146147
}
147148

@@ -154,7 +155,7 @@ func rulesAlertsToAPIAlerts(s storepb.PartialResponseStrategy, rulesAlerts []*ru
154155
Annotations: ruleAlert.Annotations,
155156
State: ruleAlert.State.String(),
156157
ActiveAt: &ruleAlert.ActiveAt,
157-
Value: ruleAlert.Value,
158+
Value: strconv.FormatFloat(ruleAlert.Value, 'e', -1, 64),
158159
}
159160
}
160161

0 commit comments

Comments
 (0)