Skip to content

Commit ed37310

Browse files
authored
Merge pull request #1050 from cortexproject/maps-yno
Small optimisation in chunk indexing
2 parents 658fa03 + 5dfcaaa commit ed37310

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pkg/util/extract/extract.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ func MetricNameFromLabelPairs(labels []client.LabelPair) ([]byte, error) {
2222

2323
// MetricNameFromMetric extract the metric name from a model.Metric
2424
func MetricNameFromMetric(m model.Metric) (model.LabelValue, error) {
25-
for name, value := range m {
26-
if name == model.MetricNameLabel {
27-
return value, nil
28-
}
25+
if value, found := m[model.MetricNameLabel]; found {
26+
return value, nil
2927
}
3028
return "", fmt.Errorf("no MetricNameLabel for chunk")
3129
}

0 commit comments

Comments
 (0)