open-telemetry / open-telemetry/opentelemetry-cpp

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

Open
#3,390 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Stale triage/accepted
Dominant language
C++
Stars
1.4k
Forks
632
Avg merge
1d 13h
Merged PRs (30d)
75

Description

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_;

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the AttributesHashMap::hash_map_ declaration and inspect how the surrounding code constructs and uses it. Determine an explicit small starting bucket count, then verify existing C++ tests and confirm that maps with only a few attributes no longer incur the implementation-defined initial allocation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
performance
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.