diff --git a/docs/querying/api.md b/docs/querying/api.md index fba7e9ff0..d01f15ab1 100644 --- a/docs/querying/api.md +++ b/docs/querying/api.md @@ -465,7 +465,7 @@ $ curl http://localhost:9090/api/v1/rules "severity": "page" }, "state": "firing", - "value": 1 + "value": "1e+00" } ], "annotations": { @@ -522,7 +522,7 @@ $ curl http://localhost:9090/api/v1/alerts "alertname": "my-alert" }, "state": "firing", - "value": 1 + "value": "1e+00" } ] }, diff --git a/web/api/v1/api.go b/web/api/v1/api.go index bfb4aec9f..465594f54 100644 --- a/web/api/v1/api.go +++ b/web/api/v1/api.go @@ -694,7 +694,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"` } func (api *API) alerts(r *http.Request) apiFuncResult { @@ -721,7 +721,7 @@ func rulesAlertsToAPIAlerts(rulesAlerts []*rules.Alert) []*Alert { Annotations: ruleAlert.Annotations, State: ruleAlert.State.String(), ActiveAt: &ruleAlert.ActiveAt, - Value: ruleAlert.Value, + Value: strconv.FormatFloat(ruleAlert.Value, 'e', -1, 64), } }