Skip to content

sdk/trace: More trace id tests#7155

Merged
MrAlias merged 7 commits intoopen-telemetry:mainfrom
bboreham:more-trace-id-tests
Aug 21, 2025
Merged

sdk/trace: More trace id tests#7155
MrAlias merged 7 commits intoopen-telemetry:mainfrom
bboreham:more-trace-id-tests

Conversation

@bboreham
Copy link
Copy Markdown
Contributor

@bboreham bboreham commented Aug 8, 2025

  • Check that IDs round-trip between binary and hex string formats. TestIDsRoundTrip is patterned after TestNewIDs.
  • Check that bad values give the expected errors.
  • Use larger values in TestWithIDGenerator. Previously, nearly all the bits were zero so a mistake in encoding/decoding higher bits could be missed.
    Start with arbitrary values with more bits set.
    (Span ID still has top half as zero due to taking an uint64)
  • Modify testIDGenerator so this ^^ change runs on 32-bit platforms.

The idea for more tests arose while considering #6791.

Does not need a CHANGELOG entry - test only.

Check that IDs round-trip between binary and hex string formats.
Check that bad values give the expected errors.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
Previously, nearly all the bits were zero so a mistake in
encoding/decoding higher bits could be missed.
Start with arbitrary values with more bits set.

(Span ID still has top half as zero due to taking an int)

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This lets us do richer tests on 32-bit platforms.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
@MrAlias MrAlias added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Aug 8, 2025
Comment thread sdk/trace/trace_test.go Outdated
Comment thread sdk/trace/trace_test.go
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.0%. Comparing base (d31fb11) to head (259576b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #7155     +/-   ##
=======================================
- Coverage   83.0%   83.0%   -0.1%     
=======================================
  Files        265     265             
  Lines      24661   24661             
=======================================
- Hits       20474   20473      -1     
- Misses      3810    3811      +1     
  Partials     377     377             

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread sdk/trace/trace_test.go Outdated
Comment thread sdk/trace/trace_test.go Outdated
Comment thread sdk/trace/trace_test.go
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
@MrAlias MrAlias merged commit 8b17b89 into open-telemetry:main Aug 21, 2025
38 checks passed
@MrAlias MrAlias added this to the v1.38.0 milestone Aug 21, 2025
dmathieu added a commit that referenced this pull request Oct 6, 2025
Fixes #7160

- Modified `testIDGenerator` to have both low and high bits (in uint64
form) since we can't store 128 bits integer
- start with high seed values (taken from
#7155)
- validate both high and low 64 bits of trace id

Does not need a CHANGELOG entry - test only.

---------

Co-authored-by: Damien Mathieu <42@dmathieu.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: dmathieu <damien.mathieu@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip Changelog PRs that do not require a CHANGELOG.md entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants