opentelemetry-cpp icon indicating copy to clipboard operation
opentelemetry-cpp copied to clipboard

The default size of AttributesHashMap::hash_map_ could be too large

Open ThomsonTan opened this issue 5 months ago • 0 comments

The current AttributesHashMap::hash_map_ has unspecified bucket count which makes it implementation defined. The implementation may starts with some large value like 13 on GCC which wastes memory for scenario where only a few attributes are used. For such scenario, it will be helpful to start with explicit small number of buckets.

std::unordered_map<MetricAttributes, std::unique_ptr<Aggregation>, CustomHash> hash_map_;

ThomsonTan avatar May 07 '25 01:05 ThomsonTan