Hash collision risk of metric data aggregation #3060
Labels
bug
Something isn't working
Stale
triage/accepted
Indicates an issue or PR is ready to be actively worked on.
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
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 theunordered_map
?Thanks
The text was updated successfully, but these errors were encountered: