Add test for malformed le label

This annotation could be split into two to be clearer for the user
(one for missing, and one for malformed). This is outside of the scope
of this change.

Signed-off-by: Joshua Hesketh <josh@nitrotech.org>
This commit is contained in:
Joshua Hesketh 2025-01-15 22:30:59 +11:00
parent 67a34f7f98
commit 28e37c7a38

View file

@ -3514,6 +3514,16 @@ func TestHistogramQuantileAnnotations(t *testing.T) {
},
expectedInfoAnnotations: []string{},
},
"warning annotation for malformed le label": {
data: `
myHistogram{le="Hello World"} 0+2x10
`,
expr: "histogram_quantile(0.5, myHistogram)",
expectedWarningAnnotations: []string{
`PromQL warning: bucket label "le" is missing or has a malformed value of "Hello World" for metric name "myHistogram" (1:25)`,
},
expectedInfoAnnotations: []string{},
},
"warning annotation for mixed histograms": {
data: `
mixedHistogram{le="0.1"} 0+2x10