Skip to content

Conversation

carles-grafana
Copy link
Contributor

@carles-grafana carles-grafana commented Jun 13, 2025

We had this issue in the distributor (#5186), it it can happen in the ingester too with live traces.

In the ingester we use a map to store live traces where the key is a hash of the Trace ID. Because we were using 32-bit hashes, in cases where tens of thousands of traces were pushed, there was a high chance of collision in which case spans from different traces would be incorrectly combined. By using a 64-bit we minimize the collision chance.

What this PR does:

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@carles-grafana carles-grafana force-pushed the tempo-fix-ingester-hash-collision branch from 0df8471 to c6bc1fa Compare June 13, 2025 10:08
@carles-grafana carles-grafana marked this pull request as ready for review June 13, 2025 10:43
@mdisibio mdisibio added the type/bug Something isn't working label Jun 13, 2025
Copy link
Contributor

@mdisibio mdisibio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes lgtm and I didn't see any other references to fnv.New32 that need to be removed (only still used by compaction sharding).

Can you add a test that covers some of the found/known colliding IDs and make sure they work as expected?

We had this issue in the distributor, it it can happen in the
ingester too with live traces.
@carles-grafana carles-grafana force-pushed the tempo-fix-ingester-hash-collision branch from 2b72893 to 3080025 Compare June 16, 2025 11:14
@carles-grafana
Copy link
Contributor Author

@mdisibio I've added a test to check for collisions. I've also run the same test in main and the same span IDs where found in multiple traces, so I can confirm that this fixes the issue for live traces.

@carles-grafana carles-grafana requested a review from mdisibio June 16, 2025 13:21
@carles-grafana carles-grafana merged commit 805b11c into grafana:main Jun 16, 2025
35 of 36 checks passed
carles-grafana added a commit to carles-grafana/tempo that referenced this pull request Jun 17, 2025
* ingester: use a 64-bit hash to avoid collisions

We had this issue in the distributor, it it can happen in the
ingester too with live traces.

* Update changelog

* Add test for live traces collision
carles-grafana added a commit to carles-grafana/tempo that referenced this pull request Jun 17, 2025
* ingester: use a 64-bit hash to avoid collisions

We had this issue in the distributor, it it can happen in the
ingester too with live traces.

* Update changelog

* Add test for live traces collision
carles-grafana added a commit that referenced this pull request Jun 18, 2025
* ingester: use a 64-bit hash to avoid collisions

We had this issue in the distributor, it it can happen in the
ingester too with live traces.

* Update changelog

* Add test for live traces collision
carles-grafana added a commit that referenced this pull request Jun 18, 2025
* ingester: use a 64-bit hash to avoid collisions

We had this issue in the distributor, it it can happen in the
ingester too with live traces.

* Update changelog

* Add test for live traces collision
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport release-v2.8 type/bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants