Repository navigation
feat: derive PartialEq and Eq for MetricType and Unit - #366
Merged
krisztianfekete merged 4 commits intoNov 4, 2026
Merged
Conversation
herin049
force-pushed
the
feat/metric-type-partial-eq
branch
from
November 3, 2026 04:00
de6a045 to
95144b8
Compare
Contributor
Author
|
cc: @krisztianfekete |
krisztianfekete
left a comment
Member
There was a problem hiding this comment.
Thanks, this LGTM overall!
Two small things:
- The new tests only check what
#[derive]generates. Can you please drop them to keep the diff focused? - Optional: since you're touching these derives, would you also add
Hash? It's cheap, it's in line with Rust's API guidelines on common traits, and it lets downstream code use MetricType/Unit as map keys. No strong opinion here, though.
Signed-off-by: Lukas Hering <lukasheringb@gmail.com>
Signed-off-by: Lukas Hering <lukasheringb@gmail.com>
Signed-off-by: Lukas Hering <lukasheringb@gmail.com>
Signed-off-by: Lukas Hering <lukasheringb@gmail.com>
herin049
force-pushed
the
feat/metric-type-partial-eq
branch
from
November 3, 2026 18:21
107b577 to
5edd3b2
Compare
Contributor
Author
Thanks @krisztianfekete! Dropped the tests and added |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Derive
PartialEqandEqformetrics::MetricTypeandregistry::Unit, so they can be compared with==/!=.This is needed (not technically, but nice to have) to adopt the
prometheus-clientcrate inopentelemetry-prometheusin open-telemetry/opentelemetry-rust which needs to compare these types.Changes
MetricType: addPartialEq, Eqderives.Unit: addPartialEq, Eqderives.