Skip to content

Commit

Permalink
clean up --signoff
Browse files Browse the repository at this point in the history
  • Loading branch information
gajibade committed Dec 17, 2024
1 parent 5938f07 commit fe3f092
Showing 1 changed file with 5 additions and 30 deletions.
35 changes: 5 additions & 30 deletions pkg/common/telemetry/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,9 @@ func NewMetrics(c *MetricsConfig) (*MetricsImpl, error) {
conf.AllowedPrefixes = c.FileConfig.AllowedPrefixes
conf.BlockedPrefixes = c.FileConfig.BlockedPrefixes

impl.enableTrustDomainLabel = false
if c.FileConfig.EnableTrustDomainLabel != nil {
impl.enableTrustDomainLabel = *c.FileConfig.EnableTrustDomainLabel
} else {
impl.enableTrustDomainLabel = false
}

metricsSink, err := metrics.New(conf, fanout)
Expand All @@ -120,13 +119,7 @@ func (m *MetricsImpl) ListenAndServe(ctx context.Context) error {
}

func (m *MetricsImpl) SetGauge(key []string, val float32) {
if m.enableTrustDomainLabel {
m.SetGaugeWithLabels(key, val, nil)
} else {
for _, s := range m.metricsSinks {
s.SetGauge(key, val)
}
}
m.SetGaugeWithLabels(key, val, nil)
}

// SetGaugeWithLabels delegates to embedded metrics, sanitizing labels
Expand All @@ -148,13 +141,7 @@ func (m *MetricsImpl) EmitKey(key []string, val float32) {
}

func (m *MetricsImpl) IncrCounter(key []string, val float32) {
if m.enableTrustDomainLabel {
m.IncrCounterWithLabels(key, val, nil)
} else {
for _, s := range m.metricsSinks {
s.IncrCounter(key, val)
}
}
m.IncrCounterWithLabels(key, val, nil)
}

// IncrCounterWithLabels delegates to embedded metrics, sanitizing labels
Expand All @@ -170,13 +157,7 @@ func (m *MetricsImpl) IncrCounterWithLabels(key []string, val float32, labels []
}

func (m *MetricsImpl) AddSample(key []string, val float32) {
if m.enableTrustDomainLabel {
m.AddSampleWithLabels(key, val, nil)
} else {
for _, s := range m.metricsSinks {
s.AddSample(key, val)
}
}
m.AddSampleWithLabels(key, val, nil)
}

// AddSampleWithLabels delegates to embedded metrics, sanitizing labels
Expand All @@ -192,13 +173,7 @@ func (m *MetricsImpl) AddSampleWithLabels(key []string, val float32, labels []La
}

func (m *MetricsImpl) MeasureSince(key []string, start time.Time) {
if m.enableTrustDomainLabel {
m.MeasureSinceWithLabels(key, start, nil)
} else {
for _, s := range m.metricsSinks {
s.MeasureSince(key, start)
}
}
m.MeasureSinceWithLabels(key, start, nil)
}

// MeasureSinceWithLabels delegates to embedded metrics, sanitizing labels
Expand Down

0 comments on commit fe3f092

Please sign in to comment.