Skip to content

Conversation

charleskorn
Copy link
Contributor

What this PR does

This PR fixes an issue with the clamp, clamp_min, clamp_max, round and histogram_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

  • Tests updated.
  • [n/a] Documentation added.
  • [covered by Mimir Query Engine #10067] CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • [n/a] about-versioning.md updated with experimental features.

@charleskorn charleskorn force-pushed the charleskorn/mqe-ensure-deduplicate-and-merge branch from 2312545 to 526732d Compare January 29, 2025 06:11
@charleskorn charleskorn marked this pull request as ready for review January 29, 2025 06:11
@charleskorn charleskorn requested a review from a team as a code owner January 29, 2025 06:11
@charleskorn charleskorn enabled auto-merge (squash) January 29, 2025 06:13
Copy link
Contributor

@jhesketh jhesketh left a 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)
Copy link
Contributor

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.

Copy link
Contributor Author

@charleskorn charleskorn Feb 2, 2025

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).

I originally had this, but unfortunately a bunch of these cases fail with Prometheus' engine due to prometheus/prometheus#14695.

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.

I think adding these cases to the gauntlet would be tricky, and I think having a dedicated test for this specific problem helps make the issue (and the solution) clear for any future functions we add that are missing the deduplication step.

@charleskorn charleskorn merged commit 656dfb1 into main Jan 30, 2025
28 checks passed
@charleskorn charleskorn deleted the charleskorn/mqe-ensure-deduplicate-and-merge branch January 30, 2025 06:21
charleskorn added a commit that referenced this pull request Feb 3, 2025
* Address PR feedback: use consistent indentation in string

* Address PR feedback: make test expressions explicit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants