Skip to content

Hash collision risk of metric data aggregation #3060

@alangy98

Description

@alangy98

Hello, I have concerns regarding the hash collision issue with the current implementation of metric data aggregation, related to this PR #1993.

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 workingdo-not-staletriage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions