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 <bjboreham@gmail.com>
This commit is contained in:
parent
3d482bb7cf
commit
ba4a543ab4
|
@ -16,6 +16,7 @@ package prometheus
|
|||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -262,10 +263,11 @@ func TestCounterExemplar(t *testing.T) {
|
|||
err = e.(error)
|
||||
}
|
||||
}()
|
||||
// Should panic because of 65 runes.
|
||||
// Should panic because of 129 runes.
|
||||
counter.AddWithExemplar(42, Labels{
|
||||
"abcdefghijklmnopqrstuvwxyz": "26+16 characters",
|
||||
"x1234567": "8+15 characters",
|
||||
"z": strings.Repeat("x", 63),
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ func MakeLabelPairs(desc *Desc, labelValues []string) []*dto.LabelPair {
|
|||
}
|
||||
|
||||
// ExemplarMaxRunes is the max total number of runes allowed in exemplar labels.
|
||||
const ExemplarMaxRunes = 64
|
||||
const ExemplarMaxRunes = 128
|
||||
|
||||
// newExemplar creates a new dto.Exemplar from the provided values. An error is
|
||||
// returned if any of the label names or values are invalid or if the total
|
||||
|
|
Loading…
Reference in New Issue