Skip to content

[POC] Remove noexcept from SDK internals. - #4713

Open
marcalff wants to merge 3 commits into
open-telemetry:mainfrom
marcalff:fix_noexcept_3
Open

marcalff wants to merge 3 commits into
open-telemetry:mainfrom
marcalff:fix_noexcept_3

Conversation

@marcalff

@marcalff marcalff commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

DO NOT MERGE

Changes

Please provide a brief description of the changes here.

  • Proof of concept code, to investigate noexcept related clang-tidy warnings.
  • Remove noexcept from all SDK internal code
  • Keep noexcept for SDK entry points (for example, StartSpan)

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

@marcalff
marcalff requested a review from a team as a code owner October 18, 2026 22:02
@marcalff marcalff added the pr:do-not-merge This PR is not ready to be merged. label Oct 18, 2026
@codecov

codecov Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.23077% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.65%. Comparing base (ac7b87a) to head (39fd37d).

Files with missing lines Patch % Lines
sdk/src/trace/tracer.cc 60.00% 2 Missing ⚠️
sdk/src/trace/tracer_provider.cc 60.00% 2 Missing ⚠️
...clude/opentelemetry/sdk/logs/readable_log_record.h 0.00% 1 Missing ⚠️
sdk/include/opentelemetry/sdk/logs/recordable.h 0.00% 1 Missing ⚠️
...telemetry/sdk/metrics/state/multi_metric_storage.h 80.00% 1 Missing ⚠️
...ntelemetry/sdk/metrics/view/attributes_processor.h 85.72% 1 Missing ⚠️
sdk/include/opentelemetry/sdk/trace/recordable.h 66.67% 1 Missing ⚠️
sdk/src/logs/exporter.cc 0.00% 1 Missing ⚠️
sdk/src/logs/readable_log_record.cc 66.67% 1 Missing ⚠️
sdk/src/metrics/meter_provider.cc 75.00% 1 Missing ⚠️
... and 3 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4713      +/-   ##
==========================================
- Coverage   86.69%   86.65%   -0.04%     
==========================================
  Files         527      527              
  Lines       20902    20903       +1     
==========================================
- Hits        18119    18111       -8     
- Misses       2783     2792       +9     
Files with missing lines Coverage Δ
...clude/opentelemetry/sdk/common/atomic_unique_ptr.h 100.00% <100.00%> (ø)
...include/opentelemetry/sdk/common/attribute_utils.h 95.59% <100.00%> (-0.03%) ⬇️
...include/opentelemetry/sdk/common/circular_buffer.h 100.00% <100.00%> (ø)
...e/opentelemetry/sdk/common/circular_buffer_range.h 100.00% <100.00%> (ø)
...de/opentelemetry/sdk/common/custom_hash_equality.h 100.00% <100.00%> (ø)
...y/sdk/instrumentationscope/instrumentation_scope.h 100.00% <ø> (ø)
...etry/sdk/instrumentationscope/scope_configurator.h 100.00% <100.00%> (ø)
...pentelemetry/sdk/logs/batch_log_record_processor.h 100.00% <ø> (ø)
sdk/include/opentelemetry/sdk/logs/exporter.h 100.00% <100.00%> (ø)
...include/opentelemetry/sdk/logs/log_record_limits.h 100.00% <100.00%> (ø)
... and 78 more

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

@mateenali66 mateenali66 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

built cda0cd10 (macOS, ABI v1), 1147/1147 tests pass. three things for when this becomes real PRs.

  1. MetricReader::Collect losing noexcept makes the catch in PeriodicExportingMetricReader::CollectAndExportOnce() reachable, and it returns before advancing force_flush_notified_sequence_ (periodic_exporting_metric_reader.cc:184-204). with an exporter whose Export() throws, ForceFlush(2s) times out and MeterProvider::Shutdown() with the default timeout never returns.
  2. Span::Span and its attribute lambda stay noexcept (span.cc:62, :81), so a throwing OnStart() terminates inside StartSpan() before the catch at tracer.cc:170. #4700 now catches inside each exporter's MakeRecordable(), the opposite convention.
  3. part of the clang-tidy drop is the check not seeing through pure virtuals. with TreatFunctionsWithoutSpecificationAsThrowing: OnlyUndefined (clang-tidy 23) new escapes show at Span::Span and Logger::EmitLogRecord.

is TracerProvider::Shutdown() meant to stay an entry point? a throwing exporter Shutdown() now reaches the caller.

This branch has not been deployed

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

Labels

pr:do-not-merge This PR is not ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants