code tweaks
This commit is contained in:
parent
2f83edc426
commit
268bc7d8a2
@ -3,6 +3,7 @@ package weather
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"slices"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
@ -64,20 +65,10 @@ func (r *MetricRecorder) Record(opts *RecordOpts) {
|
||||
func (o *RecordOpts) keep() bool {
|
||||
// If keep fields are given, only check keep fields
|
||||
if len(o.Station.KeepMetrics) > 0 {
|
||||
for _, f := range o.Station.KeepMetrics {
|
||||
if f == o.Field {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return slices.Contains(o.Station.KeepMetrics, o.Field)
|
||||
}
|
||||
|
||||
for _, f := range o.Station.DropMetrics {
|
||||
if f == o.Field {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
return !slices.Contains(o.Station.DropMetrics, o.Field)
|
||||
}
|
||||
|
||||
func (r *MetricRecorder) recordInt(
|
||||
|
Loading…
x
Reference in New Issue
Block a user