mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-11-22 23:41:00 +00:00
Merge pull request #193 from bakins/statsd_exporter_events_total
Add metric for count of events by action
This commit is contained in:
commit
178d130388
2 changed files with 10 additions and 0 deletions
|
@ -355,6 +355,7 @@ func (b *Exporter) handleEvent(event Event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if mapping.Action == mapper.ActionTypeDrop {
|
if mapping.Action == mapper.ActionTypeDrop {
|
||||||
|
eventsActions.WithLabelValues("drop").Inc()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,6 +376,7 @@ func (b *Exporter) handleEvent(event Event) {
|
||||||
for label, value := range labels {
|
for label, value := range labels {
|
||||||
prometheusLabels[label] = value
|
prometheusLabels[label] = value
|
||||||
}
|
}
|
||||||
|
eventsActions.WithLabelValues(string(mapping.Action)).Inc()
|
||||||
} else {
|
} else {
|
||||||
eventsUnmapped.Inc()
|
eventsUnmapped.Inc()
|
||||||
metricName = escapeMetricName(event.MetricName())
|
metricName = escapeMetricName(event.MetricName())
|
||||||
|
|
|
@ -109,6 +109,13 @@ var (
|
||||||
},
|
},
|
||||||
[]string{"reason"},
|
[]string{"reason"},
|
||||||
)
|
)
|
||||||
|
eventsActions = prometheus.NewCounterVec(
|
||||||
|
prometheus.CounterOpts{
|
||||||
|
Name: "statsd_exporter_events_actions_total",
|
||||||
|
Help: "The total number of StatsD events by action.",
|
||||||
|
},
|
||||||
|
[]string{"action"},
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -127,4 +134,5 @@ func init() {
|
||||||
prometheus.MustRegister(mappingsCount)
|
prometheus.MustRegister(mappingsCount)
|
||||||
prometheus.MustRegister(conflictingEventStats)
|
prometheus.MustRegister(conflictingEventStats)
|
||||||
prometheus.MustRegister(errorEventStats)
|
prometheus.MustRegister(errorEventStats)
|
||||||
|
prometheus.MustRegister(eventsActions)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue