From bbd5227a1c169bff308a4fd4c2020b1c7a6ff22b Mon Sep 17 00:00:00 2001 From: Thomas Jackson Date: Tue, 18 Jul 2017 08:56:27 -0700 Subject: [PATCH] Add metric for total number of conflicting events --- exporter.go | 3 +++ telemetry.go | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/exporter.go b/exporter.go index 0a963d2..0603dc7 100644 --- a/exporter.go +++ b/exporter.go @@ -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: @@ -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: @@ -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: diff --git a/telemetry.go b/telemetry.go index c668c7d..ae07fcf 100644 --- a/telemetry.go +++ b/telemetry.go @@ -47,6 +47,13 @@ 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() { @@ -54,4 +61,5 @@ func init() { prometheus.MustRegister(networkStats) prometheus.MustRegister(configLoads) prometheus.MustRegister(mappingsCount) + prometheus.MustRegister(conflictingEventStats) }