mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-11-26 09:11:01 +00:00
Add metric for count of events by action
Signed-off-by: Brian Akins <brian@akins.org>
This commit is contained in:
parent
71df5a3198
commit
1cbc5a9b27
2 changed files with 10 additions and 0 deletions
|
@ -322,6 +322,7 @@ func (b *Exporter) handleEvent(event Event) {
|
|||
}
|
||||
|
||||
if mapping.Action == mapper.ActionTypeDrop {
|
||||
eventsActions.WithLabelValues("drop").Inc()
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -342,6 +343,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