Skip to content

Commit

Permalink
Resolves prometheus#77 add cmdline flag to drop unmapped
Browse files Browse the repository at this point in the history
* Adds `-statsd.drop-unmapped` cmdline flag which causes statsd metrics
  that don't match a mapping to be dropped. New flag defaults to "false"
  • Loading branch information
Dave Rawks committed Aug 1, 2017
1 parent 8b40f78 commit 78c1369
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ func (b *Exporter) Listen(e <-chan Events) {
}
} else {
eventsUnmapped.Inc()
if *dropUnmapped == true {
continue
}
metricName = escapeMetricName(event.MetricName())
}

Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var (
readBuffer = flag.Int("statsd.read-buffer", 0, "Size (in bytes) of the operating system's transmit read buffer associated with the UDP connection. Please make sure the kernel parameters net.core.rmem_max is set to a value greater than the value specified.")
addSuffix = flag.Bool("statsd.add-suffix", true, "Add the metric type (counter/gauge/timer) as suffix to the generated Prometheus metric (NOT recommended, but set by default for backward compatibility).")
showVersion = flag.Bool("version", false, "Print version information.")
dropUnmapped = flag.Bool("statsd.drop-unmapped", false, "Drop statsd metrics which have no matched mapping configured.")
)

func serveHTTP() {
Expand Down

0 comments on commit 78c1369

Please sign in to comment.