Skip to content

Commit

Permalink
Add mix reset hint sample delta annotation
Browse files Browse the repository at this point in the history
Signed-off-by: Jon Kartago Lamida <[email protected]>
  • Loading branch information
lamida committed Jan 10, 2025
1 parent 79d1077 commit 19045f9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/streamingpromql/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2057,6 +2057,8 @@ func TestAnnotations(t *testing.T) {
nativeHistogramsWithResetHintsMix := `
metric{reset_hint="unknown"} {{schema:0 sum:0 count:0}}+{{schema:0 sum:5 count:4 buckets:[1 2 1]}}x3
metric{reset_hint="gauge"} {{schema:0 sum:0 count:0 counter_reset_hint:gauge}}+{{schema:0 sum:5 count:4 buckets:[1 2 1] counter_reset_hint:gauge}}x3
metric{reset_hint="gauge-unknown"} {{schema:0 sum:0 count:0 counter_reset_hint:gauge}} {{schema:0 sum:0 count:0}}+{{schema:0 sum:5 count:4 buckets:[1 2 1]}}x3
metric{reset_hint="unknown-gauge"} {{schema:0 sum:0 count:0}}+{{schema:0 sum:5 count:4 buckets:[1 2 1] counter_reset_hint:gauge}}x3
`

testCases := map[string]annotationTestCase{
Expand Down Expand Up @@ -2087,6 +2089,16 @@ func TestAnnotations(t *testing.T) {
data: nativeHistogramsWithResetHintsMix,
expr: `delta(metric{reset_hint="gauge"}[3m])`,
},
"delta() native histogram first gauge last unknown CounterResetHint": {
data: nativeHistogramsWithResetHintsMix,
expr: `delta(metric{reset_hint="gauge-unknown"}[3m])`,
expectedWarningAnnotations: []string{`PromQL warning: this native histogram metric is not a gauge: "metric" (1:7)`},
},
"delta() native histogram first unknown last gauge CounterResetHint": {
data: nativeHistogramsWithResetHintsMix,
expr: `delta(metric{reset_hint="unknown-gauge"}[3m])`,
expectedWarningAnnotations: []string{`PromQL warning: this native histogram metric is not a gauge: "metric" (1:7)`},
},

"stdvar() with only floats": {
data: mixedFloatHistogramData,
Expand Down

0 comments on commit 19045f9

Please sign in to comment.