-
Notifications
You must be signed in to change notification settings - Fork 832
Open
Description
Describe the bug
We have fuzz tests that try to compare for differences between query results. However, when the query makes use of count_values and the metric is a native histogram, the value of the "value" label ends up being a compact string representation of the histogram sample value.
To Reproduce
Steps to reproduce the behavior:
- Force query to be
count_values by (__name__, status_code) (
"value",
-avg without (status_code, series, job) (
({__name__="test_series_a"} offset 3m46s and {__name__="test_series_b"})
)
)
- Run TestNativeHistogramFuzz
Expected behavior
Test should pass
Additional Context
For example, in a comparison where they should've been equal, the compact string representation of the histogram sample showed a difference between the two values:
lVal
"{count:-321, sum:-650.1333333333332, [-4,-2.82842712474619):-35.333333333333336, [-2.82842712474619,-2):-35.333333333333336, [-1.414213562373095,-1):-36.333333333333336, [-1,-0.7071067811865475):-35.333333333333336, [-0.001,0.001]:-36.333333333333336, (0.7071067811865475,1]:-35.333333333333336, (1,1.414213562373095]:-36.333333333333336, (2,2.82842712474619]:-35.333333333333336, (2.82842712474619,4]:-35.333333333333336}"
rVal ^ (an extra 6) ^ (an extra 6)
"{count:-321, sum:-650.1333333333332, [-4,-2.82842712474619):-35.33333333333333, [-2.82842712474619,-2):-35.33333333333333, [-1.414213562373095,-1):-36.333333333333336, [-1,-0.7071067811865475):-35.33333333333333, [-0.001,0.001]:-36.333333333333336, (0.7071067811865475,1]:-35.33333333333333, (1,1.414213562373095]:-36.333333333333336, (2,2.82842712474619]:-35.33333333333333, (2.82842712474619,4]:-35.33333333333333}"
so it wouldn't be enough to simply compare the two string values.
@harry671003 added support for handling count_values in fuzz tests in #6474.
@SungJin1212 added TestNativeHistogramFuzz #6654