Merge pull request #224 from ptqa/master

Fix inconsistent label cardinality error
This commit is contained in:
Matthias Rampke 2019-05-27 09:06:29 +00:00 committed by GitHub
commit 56a091a693
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -458,7 +458,6 @@ func (b *Exporter) handleEvent(event Event) {
metricName := "" metricName := ""
prometheusLabels := event.Labels() prometheusLabels := event.Labels()
sortedLabelNames := getSortedLabelNames(prometheusLabels)
if present { if present {
if mapping.Name == "" { if mapping.Name == "" {
log.Debugf("The mapping of '%s' for match '%s' generates an empty metric name", event.MetricName(), mapping.Match) log.Debugf("The mapping of '%s' for match '%s' generates an empty metric name", event.MetricName(), mapping.Match)
@ -475,6 +474,7 @@ func (b *Exporter) handleEvent(event Event) {
metricName = escapeMetricName(event.MetricName()) metricName = escapeMetricName(event.MetricName())
} }
sortedLabelNames := getSortedLabelNames(prometheusLabels)
switch ev := event.(type) { switch ev := event.(type) {
case *CounterEvent: case *CounterEvent:
// We don't accept negative values for counters. Incrementing the counter with a negative number // We don't accept negative values for counters. Incrementing the counter with a negative number