diff --git a/exporter.go b/exporter.go index f8eaedd..e22f5e4 100644 --- a/exporter.go +++ b/exporter.go @@ -458,7 +458,6 @@ func (b *Exporter) handleEvent(event Event) { metricName := "" prometheusLabels := event.Labels() - sortedLabelNames := getSortedLabelNames(prometheusLabels) if present { if mapping.Name == "" { 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()) } + sortedLabelNames := getSortedLabelNames(prometheusLabels) switch ev := event.(type) { case *CounterEvent: // We don't accept negative values for counters. Incrementing the counter with a negative number