-
Notifications
You must be signed in to change notification settings - Fork 634
MQE: mangle native histograms in returned slices to catch use-after-return bugs + fix issues found #10010
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
Conversation
# Conflicts: # CHANGELOG.md
fad9a56
to
d59e928
Compare
|
||
h.ZeroCount = 12345678 | ||
h.Count = 12345678 | ||
h.Sum = 12345678 |
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.
(nit) it's very unlikely, but if we write a test with these values elsewhere the mangle won't work. Maybe for just one of these (eg Sum) we multiply it or similar.
h.Sum = 12345678 | |
h.Sum = h.Sum * 9.87654321 |
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'm keen to keep this as simple as possible and to make the resulting histogram easy to identify. I think the likelihood of us using a histogram with these values elsewhere and also having a bug that is then hidden because of that is very, very unlikely, as you say.
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.
Fair enough, I don't hold this strongly.
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.
lgtm, sans a suggestion
What this PR does
This PR extends MQE's tests to aid in catching native histogram use-after-return bugs, and fixes some issues they've uncovered.
Now, during tests in the
streamingpromql
package, any histograms in slices returned to theHPoint
orFloatHistogram
pools will immediately be mutated. This ensures that any possible use-after-return bugs are triggered deterministically.Which issue(s) this PR fixes or relates to
(none)
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]
.about-versioning.md
updated with experimental features.