[exporter/elasticsearch] Use 64 bit hash to reduce metric grouping hash and _metric_names_hash collision#41240
Merged
Merged
Conversation
carsonip
commented
Jul 10, 2025
carsonip
left a comment
Contributor
Author
There was a problem hiding this comment.
[to reviewer] This leaves us with _metric_names_hash using fnv.New32a. Do we feel comfortable changing it to xxhash as well?
| hasher := xxhash.New() | ||
|
|
||
| timestampBuf := make([]byte, 8) | ||
| binary.LittleEndian.PutUint64(timestampBuf, uint64(dp.Timestamp())) |
Contributor
Author
There was a problem hiding this comment.
[to reviewer] it is actually possible to make timestamp and starttimestamp a field in the HashKey struct to reduce a dimension of possible hash collision.
axw
approved these changes
Jul 11, 2025
axw
left a comment
Contributor
There was a problem hiding this comment.
metric per doc cannot come soon enough 🥹
songy23
approved these changes
Jul 11, 2025
Dylan-M
pushed a commit
to Dylan-M/opentelemetry-collector-contrib
that referenced
this pull request
Aug 5, 2025
…sh and _metric_names_hash collision (open-telemetry#41240) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Replace 32 bit hash with 64 bit xxhash to reduce metric grouping hash collisions and `_metric_names_hash` collisions. The former has a higher risk of data loss. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#41208 <!--Describe what testing was performed and which tests were added.--> #### Testing <!--Describe the documentation added.--> #### Documentation <!--Please delete paragraphs that you did not use before submitting.-->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Replace 32 bit hash with 64 bit xxhash to reduce metric grouping hash collisions and
_metric_names_hashcollisions. The former has a higher risk of data loss.Link to tracking issue
Fixes #41208
Testing
Documentation