Skip to content

Commit

Permalink
Add metric for total number of conflicting events
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksontj committed Jul 18, 2017
1 parent c1791d7 commit bbd5227
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ func (b *Exporter) Listen(e <-chan Events) {
eventStats.WithLabelValues("counter").Inc()
} else {
log.Errorf(regErrF, metricName, err)
conflictingEventStats.WithLabelValues("counter").Inc()
}

case *GaugeEvent:
Expand All @@ -268,6 +269,7 @@ func (b *Exporter) Listen(e <-chan Events) {
eventStats.WithLabelValues("gauge").Inc()
} else {
log.Errorf(regErrF, metricName, err)
conflictingEventStats.WithLabelValues("gauge").Inc()
}

case *TimerEvent:
Expand All @@ -281,6 +283,7 @@ func (b *Exporter) Listen(e <-chan Events) {
eventStats.WithLabelValues("timer").Inc()
} else {
log.Errorf(regErrF, metricName, err)
conflictingEventStats.WithLabelValues("timer").Inc()
}

default:
Expand Down
8 changes: 8 additions & 0 deletions telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,19 @@ var (
Name: "statsd_exporter_loaded_mappings",
Help: "The current number of configured metric mappings.",
})
conflictingEventStats = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "statsd_exporter_events_conflict_total",
Help: "The total number of StatsD events with conflicting names.",
},
[]string{"type"},
)
)

func init() {
prometheus.MustRegister(eventStats)
prometheus.MustRegister(networkStats)
prometheus.MustRegister(configLoads)
prometheus.MustRegister(mappingsCount)
prometheus.MustRegister(conflictingEventStats)
}

0 comments on commit bbd5227

Please sign in to comment.