mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-11-14 03:11:58 +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 {
|
||||
eventsActions.WithLabelValues("drop").Inc()
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -375,6 +376,7 @@ func (b *Exporter) handleEvent(event Event) {
|
|||
for label, value := range labels {
|
||||
prometheusLabels[label] = value
|
||||
}
|
||||
eventsActions.WithLabelValues(string(mapping.Action)).Inc()
|
||||
} else {
|
||||
eventsUnmapped.Inc()
|
||||
metricName = escapeMetricName(event.MetricName())
|
||||
|
|
|
@ -109,6 +109,13 @@ var (
|
|||
},
|
||||
[]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() {
|
||||
|
@ -127,4 +134,5 @@ func init() {
|
|||
prometheus.MustRegister(mappingsCount)
|
||||
prometheus.MustRegister(conflictingEventStats)
|
||||
prometheus.MustRegister(errorEventStats)
|
||||
prometheus.MustRegister(eventsActions)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue