Skip to content

Conversation

alexweav
Copy link
Contributor

What this PR does

This PR builds on the refactor in #12792.
By default, RW2 deserialization deduplicates metric metadata by family name. All metadata beyond the first instance for a given family are discarded. This PR adds a new deserialization option, called SkipDeduplicateMetadata, plus a new metadataSet implementation that avoids the deduplication and preserves all given metadata and ordering.

This is done so that we can preserve metadata to the letter, even if it conflicts, ensuring we adhere to prometheus behavior particularly in RW1.0.

RW1 requests don't have the duplication that natural RW2 requests tend to have. Natural RW2 requests will already be deduplicated in the distributor before they reach the ingest-storage layer, so this change does not add undue duplication for clients sending RW2.0 into Mimir.

Which issue(s) this PR fixes or relates to

contrib https://github.com/grafana/mimir-squad/issues/2253

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]. If changelog entry is not needed, please add the changelog-not-needed label to the PR.
  • about-versioning.md updated with experimental features.

@alexweav alexweav added the changelog-not-needed PRs that don't need a CHANGELOG.md entry label Sep 24, 2025
// SkipDeduplicateMetadata skips deduplication of RW2 metadata by metric family name.
// Normally this is done because RW2 requests to repeat metadata as it's embedded in timeseries.
// Some applications, like RW1->RW2 translation, might choose to disable it.
// Has no effect on marshalled or existing strucs; must be set prior to Unmarshal calls.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit]

Suggested change
// Has no effect on marshalled or existing strucs; must be set prior to Unmarshal calls.
// Has no effect on marshalled or existing structs; must be set prior to Unmarshal calls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-not-needed PRs that don't need a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants