code tweaks
All checks were successful
Build and Publish / release (push) Has been skipped
Build and Publish / check-chart (push) Successful in 10s
Build and Publish / helm-release (push) Has been skipped

This commit is contained in:
Ryan McGuire 2025-04-03 10:44:43 -04:00
parent 2f83edc426
commit 268bc7d8a2

View File

@ -3,6 +3,7 @@ package weather
import ( import (
"context" "context"
"errors" "errors"
"slices"
"github.com/rs/zerolog" "github.com/rs/zerolog"
"go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/attribute"
@ -64,20 +65,10 @@ func (r *MetricRecorder) Record(opts *RecordOpts) {
func (o *RecordOpts) keep() bool { func (o *RecordOpts) keep() bool {
// If keep fields are given, only check keep fields // If keep fields are given, only check keep fields
if len(o.Station.KeepMetrics) > 0 { if len(o.Station.KeepMetrics) > 0 {
for _, f := range o.Station.KeepMetrics { return slices.Contains(o.Station.KeepMetrics, o.Field)
if f == o.Field {
return true
}
}
return false
} }
for _, f := range o.Station.DropMetrics { return !slices.Contains(o.Station.DropMetrics, o.Field)
if f == o.Field {
return false
}
}
return true
} }
func (r *MetricRecorder) recordInt( func (r *MetricRecorder) recordInt(