Skip to content

[CODE HEALTH] Cleanup nostd variant access for noexcept methods in api and sdk#3965

Draft
dbarker wants to merge 2 commits intoopen-telemetry:mainfrom
dbarker:cleanup_nostd_variant_access
Draft

[CODE HEALTH] Cleanup nostd variant access for noexcept methods in api and sdk#3965
dbarker wants to merge 2 commits intoopen-telemetry:mainfrom
dbarker:cleanup_nostd_variant_access

Conversation

@dbarker
Copy link
Copy Markdown
Member

@dbarker dbarker commented Apr 3, 2026

Fixes # (issue)

Changes

  • replace nostd::holds_alternative/nostd::get pattern with nostd::get_if in api and sdk.
  • unit test for trace/context.h
  • expanded test cases for sdk/logger to cover trace metadata
  • fixes the following warnings

File Line Message
api/include/opentelemetry/nostd/function_ref.h 81 forwarding reference parameter 'f' is never forwarded inside the function body
api/include/opentelemetry/trace/context.h 26 an exception may be thrown in function 'IsRootSpan' which should not throw exceptions
sdk/src/logs/logger.cc 59 an exception may be thrown in function 'CreateLogRecord' which should not throw exceptions

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.23%. Comparing base (0b1c704) to head (81c5775).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3965      +/-   ##
==========================================
+ Coverage   90.13%   90.23%   +0.11%     
==========================================
  Files         230      230              
  Lines        7293     7286       -7     
==========================================
+ Hits         6573     6574       +1     
+ Misses        720      712       -8     
Files with missing lines Coverage Δ
...pi/include/opentelemetry/baggage/baggage_context.h 100.00% <100.00%> (ø)
api/include/opentelemetry/nostd/function_ref.h 77.78% <ø> (ø)
api/include/opentelemetry/trace/context.h 100.00% <100.00%> (+8.34%) ⬆️
api/include/opentelemetry/trace/tracer.h 100.00% <100.00%> (ø)
sdk/src/logs/logger.cc 97.06% <100.00%> (+14.84%) ⬆️
sdk/src/trace/tracer.cc 84.85% <100.00%> (-0.22%) ⬇️

... and 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant