You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2026-06-03 18:35:08 +02:00
fbbc5a6045
Unblocks https://github.com/open-telemetry/opentelemetry-go/pull/8166 Per https://github.com/open-telemetry/opentelemetry-go/pull/8166#issuecomment-4246787382 ## Why This updates `TestHashKVsEquality` to avoid the quadratic pairwise comparison that was causing slow runs and timeouts in CI. Below are the results from my machine. Old: ``` $ go test -run=TestHashKVs -count=1 PASS ok go.opentelemetry.io/otel/attribute 2.063s ``` New: ``` $ go test -run=TestHashKVs -count=1 PASS ok go.opentelemetry.io/otel/attribute 0.024s ``` Instead of collecting every generated testcase and comparing each hash against every other hash, the test now checks uniqueness as each case is generated by storing previously seen hashes in a map. Note that it also does not use the equality operator of `KeyValue` to determine if the hash should be equal or different. ## What - Rename the test from `TestHashKVsEquality` to `TestHashKVs` - Replace the O(n^2) post-processing loop with an O(n) streaming uniqueness check - Simplify failure reporting by removing the dedicated `msg` helper Side note: for me it also makes the test more readable (however, this is opinionated).