opentelemetry-rust icon indicating copy to clipboard operation
opentelemetry-rust copied to clipboard

propagate trace processor errors to users instead of internal logging

Open svencowart opened this issue 1 month ago • 1 comments

Remove internal logging of errors in span processors and tracer provider in favor of returning errors to callers and providing an error handler callback mechanism for background operations.

Changes

  • Add error_handler callback to BatchSpanProcessor for background errors (span drops, export failures during timer-based flushes)
  • Return errors from shutdown_with_timeout when spans were dropped
  • Remove otel_debug/otel_warn/otel_error calls from span processors
  • Simplify export error handling by propagating instead of logging
  • Update BatchSpanProcessor builder with with_error_handler() method
  • Change dropped_spans_count to Arc<AtomicUsize> for shared ownership
  • Remove shutdown error logging from TracerProviderInner

This gives users explicit control over error handling rather than relying on internal SDK logging that may be missed or not actionable.

Fixes #3210

Merge requirement checklist

  • [x] CONTRIBUTING guidelines followed
  • [x] Unit tests added/updated (if applicable)
  • [ ] Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • [ ] Changes in public API reviewed (if applicable)

svencowart avatar Oct 24 '25 22:10 svencowart

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: svencowart / name: Sven Cowart (47fca8e050d213565448a171138a58dcddfc2b3f)