Skip to content

promqltest: Allow testing of native histogram counter reset hint #17615

@beorn7

Description

@beorn7

The promql testing framework already allows specifying a counter reset hint in a native histogram that is part of the expected result. However, the counter reset hint is then not compared with the one in the actual result.

Example of a test specifying a counter reset hint (which isn't really tested):

# Start with custom, end with exponential. Return the exponential histogram divided by 48.
# (The 1st sample is the NHCB with count:1. It is mostly ignored with the exception of the
# count, which means the rate calculation extrapolates until the count hits 0.)
eval instant at 1m rate(some_metric[1m])
expect no_warn
{} {{count:0.08333333333333333 sum:0.10416666666666666 counter_reset_hint:gauge buckets:[0.020833333333333332 0.041666666666666664 0.020833333333333332]}}

This is probably not as easy as adding this comparison. Ideally, we could implement a semantics where not specifying the counter reset hint means "I don't care about the counter reset", while an explicitly specified counter reset hint means "please check this". Otherwise, we have to rework all tests to explicitly specify the hint, as long as it is not the default (which is counter_reset_hint:unknown).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions