- Notifications
You must be signed in to change notification settings - Fork 500
Closed
Labels
bugSomething isn't workingSomething isn't workingdo-not-staletriage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.
Description
Hello, I have concerns regarding the hash collision issue with the current implementation of metric data aggregation, related to this PR #1993.
opentelemetry-cpp/sdk/include/opentelemetry/sdk/metrics/state/attributes_hashmap.h
Line 201 in c6d3945
std::unordered_map<size_t, std::pair<MetricAttributes, std::unique_ptr<Aggregation>>> hash_map_; |
The aggregation map uses size_t as the key type, and the hash code of the attribute set is treated as a unique identifier. However, if two different attribute sets happen to generate the same hash code, it could lead to collisions, and I haven’t seen any handling for this scenario in the current logic.
Why not consider using the MetricAttributes
instead of its hash code as the key of the unordered_map
?
Thanks
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingdo-not-staletriage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.