Add metric for total number of conflicting events

This commit is contained in:
Thomas Jackson 2017-07-18 08:56:27 -07:00
parent c1791d7ecb
commit bbd5227a1c
2 changed files with 11 additions and 0 deletions

View file

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

View file

@ -47,6 +47,13 @@ var (
Name: "statsd_exporter_loaded_mappings", Name: "statsd_exporter_loaded_mappings",
Help: "The current number of configured metric 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() { func init() {
@ -54,4 +61,5 @@ func init() {
prometheus.MustRegister(networkStats) prometheus.MustRegister(networkStats)
prometheus.MustRegister(configLoads) prometheus.MustRegister(configLoads)
prometheus.MustRegister(mappingsCount) prometheus.MustRegister(mappingsCount)
prometheus.MustRegister(conflictingEventStats)
} }