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 14, 2017
1 parent aeab290 commit 59bdece
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 @@ -266,6 +266,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 @@ -41,6 +41,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 59bdece

Please sign in to comment.