Alerting: Rename caps to captures as cap is a reserved word (#63432)

This commit is contained in:
George Robinson
2023-02-20 10:08:36 +00:00
committed by GitHub
parent aacf9da969
commit c637a5543e
2 changed files with 16 additions and 16 deletions
@@ -49,20 +49,20 @@ func (v Value) String() string {
return strconv.FormatFloat(v.Value, 'f', -1, 64)
}
func NewValues(caps map[string]eval.NumberValueCapture) map[string]Value {
func NewValues(captures map[string]eval.NumberValueCapture) map[string]Value {
values := make(map[string]Value)
for refID, cap := range caps {
for refID, capture := range captures {
var f float64
// A RefID might be missing a value if there was no data or an error.
// If that is the case, use "not a number". We don't use 0, or -1, as
// either of those are possible values for a RefID.
if cap.Value != nil {
f = *cap.Value
if capture.Value != nil {
f = *capture.Value
} else {
f = math.NaN()
}
values[refID] = Value{
Labels: Labels(cap.Labels),
Labels: Labels(capture.Labels),
Value: f,
}
}