Stay backward compatible

pull/101196/head
Mostafa Moradian 5 months ago
parent a6e90ed0f5
commit 689230161c
No known key found for this signature in database
GPG Key ID: F77FCEA0D3854DA3
  1. 6
      pkg/services/ngalert/state/historian/loki_http.go

@ -159,6 +159,12 @@ type Sample struct {
}
func (r *Sample) MarshalJSON() ([]byte, error) {
// For backward compatibility, if M is nil, we don't include it in the JSON.
if r.M == nil {
return json.Marshal([]any{
fmt.Sprintf("%d", r.T.UnixNano()), r.V,
})
}
return json.Marshal([]any{
fmt.Sprintf("%d", r.T.UnixNano()), r.V, r.M,
})

Loading…
Cancel
Save