Skip to content

Commit

Permalink
Keep track of metric names on the metric statsd_exporter_events_confl…
Browse files Browse the repository at this point in the history
…ict_total

Signed-off-by: Pedro Tanaka <pedro.tanaka@shopify.com>
  • Loading branch information
pedro-stanaka committed Dec 23, 2024
1 parent 32fee3f commit d45b0e3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ var (
Name: "statsd_exporter_events_conflict_total",
Help: "The total number of StatsD events with conflicting names.",
},
[]string{"type"},
[]string{"type", "metric_name"},
)
errorEventStats = promauto.NewCounterVec(
prometheus.CounterOpts{
Expand Down
8 changes: 4 additions & 4 deletions pkg/exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (b *Exporter) handleEvent(thisEvent event.Event) {
b.EventStats.WithLabelValues("counter").Inc()
} else {
b.Logger.Debug(regErrF, "metric", metricName, "error", err)
b.ConflictingEventStats.WithLabelValues("counter").Inc()
b.ConflictingEventStats.WithLabelValues("counter", metricName).Inc()
}

case *event.GaugeEvent:
Expand All @@ -152,7 +152,7 @@ func (b *Exporter) handleEvent(thisEvent event.Event) {
b.EventStats.WithLabelValues("gauge").Inc()
} else {
b.Logger.Debug(regErrF, "metric", metricName, "error", err)
b.ConflictingEventStats.WithLabelValues("gauge").Inc()
b.ConflictingEventStats.WithLabelValues("gauge", metricName).Inc()
}

case *event.ObserverEvent:
Expand All @@ -172,7 +172,7 @@ func (b *Exporter) handleEvent(thisEvent event.Event) {
b.EventStats.WithLabelValues("observer").Inc()
} else {
b.Logger.Debug(regErrF, "metric", metricName, "error", err)
b.ConflictingEventStats.WithLabelValues("observer").Inc()
b.ConflictingEventStats.WithLabelValues("observer", metricName).Inc()
}

case mapper.ObserverTypeDefault, mapper.ObserverTypeSummary:
Expand All @@ -182,7 +182,7 @@ func (b *Exporter) handleEvent(thisEvent event.Event) {
b.EventStats.WithLabelValues("observer").Inc()
} else {
b.Logger.Debug(regErrF, "metric", metricName, "error", err)
b.ConflictingEventStats.WithLabelValues("observer").Inc()
b.ConflictingEventStats.WithLabelValues("observer", metricName).Inc()
}

default:
Expand Down
2 changes: 1 addition & 1 deletion pkg/exporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ var (
Name: "statsd_exporter_events_conflict_total",
Help: "The total number of StatsD events with conflicting names.",
},
[]string{"type"},
[]string{"type", "metric_name"},
)
errorEventStats = prometheus.NewCounterVec(
prometheus.CounterOpts{
Expand Down

0 comments on commit d45b0e3

Please sign in to comment.