Skip to content

Commit ba4a543

Browse files
authored
Raise exemplar labels limit from 64 to 128 (#1091)
In line with the OpenMetrics spec: "The combined length of the label names and values of an Exemplar's LabelSet MUST NOT exceed 128 UTF-8 character code points" https://github.com/OpenObservability/OpenMetrics/blob/98ae26c87b/specification/OpenMetrics.md#exemplars Signed-off-by: Bryan Boreham <[email protected]>
1 parent 3d482bb commit ba4a543

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

prometheus/counter_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package prometheus
1616
import (
1717
"fmt"
1818
"math"
19+
"strings"
1920
"testing"
2021
"time"
2122

@@ -262,10 +263,11 @@ func TestCounterExemplar(t *testing.T) {
262263
err = e.(error)
263264
}
264265
}()
265-
// Should panic because of 65 runes.
266+
// Should panic because of 129 runes.
266267
counter.AddWithExemplar(42, Labels{
267268
"abcdefghijklmnopqrstuvwxyz": "26+16 characters",
268269
"x1234567": "8+15 characters",
270+
"z": strings.Repeat("x", 63),
269271
})
270272
return nil
271273
}

prometheus/value.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func MakeLabelPairs(desc *Desc, labelValues []string) []*dto.LabelPair {
200200
}
201201

202202
// ExemplarMaxRunes is the max total number of runes allowed in exemplar labels.
203-
const ExemplarMaxRunes = 64
203+
const ExemplarMaxRunes = 128
204204

205205
// newExemplar creates a new dto.Exemplar from the provided values. An error is
206206
// returned if any of the label names or values are invalid or if the total

0 commit comments

Comments
 (0)