-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #191: crash on empty metric name #192
Conversation
Signed-off-by: Ivan Izaguirre <[email protected]>
Signed-off-by: Ivan Izaguirre <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! This looks great so far, I only have a few requests for improving the observability of this case.
exporter.go
Outdated
@@ -333,6 +333,10 @@ func (b *Exporter) handleEvent(event Event) { | |||
metricName := "" | |||
prometheusLabels := event.Labels() | |||
if present { | |||
if mapping.Name == "" { | |||
log.Debugf("The mapping for match \"%v\" generates an empty metric name.", mapping.Match) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add a metric to track this. On line 255 we are already (mis)using the eventStats
counter to track negative increments, but I think it would be better if you set up a new metric vector for event errors, and also changed the negative-counter to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, please also add event.MetricName()
to the log line, this will make it much easier to track down what input causes this.
Signed-off-by: Ivan Izaguirre <[email protected]>
This should be it. Tests for the telemetry counters could be cleaner but I don't know a way to reset them between tests. |
Signed-off-by: Ivan Izaguirre <[email protected]>
Wonderful, thank you very much! |
add note about the metric change.
* [CHANGE] Do not run as root in the Docker container by default ([#202](#202)) * [FEATURE] Add metric for count of events by action ([#193](#193)) * [FEATURE] Add metric for count of distinct metric names ([#200](#200)) * [FEATURE] Add UNIX socket listener support ([#199](#199)) * [FEATURE] Accept Datadog [distributions](https://docs.datadoghq.com/graphing/metrics/distributions/) ([#211](#211)) * [ENHANCEMENT] Add a health check to the Docker container ([#182](#182)) * [ENHANCEMENT] Allow inconsistent label sets ([#194](#194)) * [ENHANCEMENT] Speed up sanitization of metric names ([#197](#197)) * [ENHANCEMENT] Enable pprof endpoints ([#205](#205)) * [ENHANCEMENT] DogStatsD tag parsing is faster ([#210](#210)) * [ENHANCEMENT] Cache mapped metrics ([#198](#198)) * [BUGFIX] Fix panic if a mapping resulted in an empty name ([#192](#192)) * [BUGFIX] Ensure that there are always default quantiles if using summaries ([#212](#212)) * [BUGFIX] Prevent ingesting conflicting metric types that would make scraping fail ([#213](#213)) With #192, the count of events rejected because of negative counter increments has moved into the `statsd_exporter_events_error_total` metric, instead of being lumped in with the different kinds of successful events. Signed-off-by: Matthias Rampke <[email protected]>
Avoids crashing when escaping empty metric names.
The metrics are ignored and a message is logged.
@matthiasr