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
@alexweav alexweav force-pushed the alexweav/skip-dedupe-medadata branch from 797f425 to 56a9f11 Compare October 2, 2025 15:16
Base automatically changed from alexweav/skip-dedupe-medadata to main October 2, 2025 15:39
@alexweav alexweav force-pushed the alexweav/skip-dedupe-metadata-impl branch from 36d540e to 6bc53ef Compare October 2, 2025 15:45
Co-authored-by: Marco Pracucci <marco@pracucci.com>
@alexweav alexweav marked this pull request as ready for review October 2, 2025 15:56
@alexweav alexweav requested a review from a team as a code owner October 2, 2025 15:56
@alexweav alexweav merged commit e33e141 into main Oct 2, 2025
37 checks passed
@alexweav alexweav deleted the alexweav/skip-dedupe-metadata-impl branch October 2, 2025 16:42
jhalterman pushed a commit that referenced this pull request Oct 2, 2025
…shalling (#12804)

#### 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](https://prometheus.io/docs/prometheus/latest/querying/api/#querying-metadata)
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 grafana/mimir-squad#2253

#### Checklist

- [x] 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`](https://github.com/grafana/mimir/blob/main/docs/sources/mimir/configure/about-versioning.md)
updated with experimental features.

---------

Co-authored-by: Marco Pracucci <marco@pracucci.com>
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