-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix TraceQL results caching bug for floats ending in .0 #4539
Merged
mdisibio
merged 1 commit into
grafana:main
from
carles-grafana:fix-traceql-float-caching
Jan 16, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -352,7 +352,7 @@ func TestQuantileOverTime(t *testing.T) { | |
// Output series with quantiles per foo | ||
// Prom labels are sorted alphabetically, traceql labels maintain original order. | ||
out := SeriesSet{ | ||
`{p="0", span.foo="bar"}`: TimeSeries{ | ||
`{p="0.0", span.foo="bar"}`: TimeSeries{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure if this is wanted @mdisibio There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah interesting side effect. It's ok. The actual label value is the same |
||
Labels: []Label{ | ||
{Name: "span.foo", Value: NewStaticString("bar")}, | ||
{Name: "p", Value: NewStaticFloat(0)}, | ||
|
@@ -374,14 +374,14 @@ func TestQuantileOverTime(t *testing.T) { | |
0, | ||
}, | ||
}, | ||
`{p="1", span.foo="bar"}`: TimeSeries{ | ||
`{p="1.0", span.foo="bar"}`: TimeSeries{ | ||
Labels: []Label{ | ||
{Name: "span.foo", Value: NewStaticString("bar")}, | ||
{Name: "p", Value: NewStaticFloat(1)}, | ||
}, | ||
Values: []float64{_512ns, _256ns, 0}, | ||
}, | ||
`{p="0", span.foo="baz"}`: TimeSeries{ | ||
`{p="0.0", span.foo="baz"}`: TimeSeries{ | ||
Labels: []Label{ | ||
{Name: "span.foo", Value: NewStaticString("baz")}, | ||
{Name: "p", Value: NewStaticFloat(0)}, | ||
|
@@ -401,7 +401,7 @@ func TestQuantileOverTime(t *testing.T) { | |
percentileHelper(0.5, _512ns, _512ns, _512ns), | ||
}, | ||
}, | ||
`{p="1", span.foo="baz"}`: TimeSeries{ | ||
`{p="1.0", span.foo="baz"}`: TimeSeries{ | ||
Labels: []Label{ | ||
{Name: "span.foo", Value: NewStaticString("baz")}, | ||
{Name: "p", Value: NewStaticFloat(1)}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a few more cases: not ending in .0, and something with the
e
scientific notation?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry my comment wasn't clear. The cases I meant were a value like
12.34
to test the.
, and something huge that outputs thee
to test that case. 12.34 is halfway covered by the second case, but let's get clear cases where input == output. The0
case isn't needed cause that's testing the int path which is already covered.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the 2 test cases and another one I think wasn't covered
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
12.34e+2
Nice catch 👍