code tweaks
This commit is contained in:
parent
2f83edc426
commit
268bc7d8a2
@ -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(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user