-
Notifications
You must be signed in to change notification settings - Fork 544
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
MQE: fix functions that could return multiple series with the same labels #10533
MQE: fix functions that could return multiple series with the same labels #10533
Conversation
2312545
to
526732d
Compare
// This test ensures that all functions correctly merge series after dropping the metric name. | ||
func TestFunctionDeduplicateAndMerge(t *testing.T) { | ||
data := ` | ||
load 30s |
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.
"clamp_min": "-Inf", | ||
"clamp_max": "Inf", | ||
"label_replace": `"__name__", "$1", "env", "(.*)"`, | ||
} |
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) I feel like it would be simpler to just define a query string for each function, and then assert that the number of functions checked is equal to len(instantVectorFunctionOperatorFactories)
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 going to merge this so we get it into next weeks release. However I think it's worth coming back to these nits.
require.NoError(t, err) | ||
defer q.Close() | ||
|
||
mimirResult := q.Exec(ctx) |
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 think we should consider passing this into Prometheus too so that we can verify we merge in the same way (as I think we've found a case previous where we don't).
Additionally, I think we should consider seeing if we can make this part of the gauntlet. ie make sure we have cases represented in there along with the selectors that would cause this to happen.
What this PR does
This PR fixes an issue with the
clamp
,clamp_min
,clamp_max
,round
andhistogram_fraction
functions in MQE: they could return multiple series with the same labels if multiple series with the same labels but different metric names were passed to the function.This PR also adds a test to ensure we catch issues like these when new functions are added in the future.
Which issue(s) this PR fixes or relates to
#10067
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]
.about-versioning.md
updated with experimental features.