-
Notifications
You must be signed in to change notification settings - Fork 236
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
Allow support for inconsistent label sets by marking metrics registered as unchecked collectors #194
Allow support for inconsistent label sets by marking metrics registered as unchecked collectors #194
Conversation
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.
This looks very good, thank you very much! Only one small request.
exporter.go
Outdated
@@ -87,23 +96,28 @@ func NewCounterContainer() *CounterContainer { | |||
} | |||
|
|||
func (c *CounterContainer) Get(metricName string, labels prometheus.Labels, help string) (prometheus.Counter, error) { | |||
counterVec, ok := c.Elements[metricName] | |||
labelNames := getLabelNames(labels) | |||
mapKey := metricName + "," + strings.Join(labelNames, ",") |
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.
you're doing this in several places, please break it out into a function so that we can be sure it's consistent
Oh also, please add the DCO sign-off to your commits. It's unfortunately required. |
registered as unchecked collectors Signed-off-by: Vitaliy Sakhartchouk <[email protected]>
Signed-off-by: Vitaliy Sakhartchouk <[email protected]>
ping @matthiasr :) |
Sorry, I was on vacation for the last week and am still catching up. I'll review this week. |
Thank you! |
Signed-off-by: Matthias Rampke <[email protected]>
* [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]>
In the current version of the statsd exporter, if a metric with a label set is sent to the statsd exporter with a label set inconsistent with an existing registered metric then that metric gets dropped. e.g
foo{a="1"}
is sent first and thenfoo{b="1"}
is sent but then dropped.This functionality was officially supported in the Go Prometheus Client via the addition of unchecked collectors. This PR makes it so each metric added is an unchecked collector which will allow metrics with inconsistent label sets not to be dropped.
I couldn't find a more elegant way to add the metric to the container map without string concat so let me know if there could be a better solution.
The test is also covering a lot of cases within one test case given that the change touches all metrics registration code so let me know if you want me to refactor that at all.
This fixes #114.
@matthiasr