Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: OTLP Exporter builders to return specific Error type #2790

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

cijothomas
Copy link
Member

@cijothomas cijothomas commented Mar 12, 2025

Fixes #2561

Also removes now unused Error enum from Log SDK. Another set of cleanup required to clean Metrics, Traces completely.
Also, the newly introduced enum ExporterBuildError is not fully refined, this can be done in follow ups. This is necessary to unblock Log SDK Stable Release.

Note: This is a breaking change for OTLP Exporter, however, the impact is minimal (most users/examples simply unwrap/expect the Result instead of matching on it.), as described in the changelog, so I propose to make the change even though OTLP Exporter is marked RC.

Copy link

codecov bot commented Mar 12, 2025

Codecov Report

Attention: Patch coverage is 73.61111% with 19 lines in your changes missing coverage. Please review.

Project coverage is 80.1%. Comparing base (8aa5b00) to head (3171749).

Files with missing lines Patch % Lines
opentelemetry-otlp/src/exporter/http/mod.rs 68.0% 8 Missing ⚠️
opentelemetry-otlp/src/exporter/mod.rs 90.3% 3 Missing ⚠️
opentelemetry-otlp/src/exporter/tonic/mod.rs 66.6% 3 Missing ⚠️
opentelemetry-otlp/src/metric.rs 0.0% 2 Missing ⚠️
opentelemetry-otlp/src/span.rs 0.0% 2 Missing ⚠️
opentelemetry-otlp/src/exporter/http/logs.rs 0.0% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #2790     +/-   ##
=======================================
+ Coverage   79.6%   80.1%   +0.5%     
=======================================
  Files        124     123      -1     
  Lines      23174   23191     +17     
=======================================
+ Hits       18456   18591    +135     
+ Misses      4718    4600    -118     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@cijothomas cijothomas requested a review from Copilot March 12, 2025 06:11

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the OTLP Exporter builders to return a well-defined error type (ExporterBuildError) instead of a generic or signal‐specific error, thereby improving error handling clarity and consistency. It also removes an unused Error enum from the Log SDK and updates tests, examples, and changelogs to reflect these breaking changes.

  • Update error type definitions and conversions across tonic and http exporters.
  • Remove the unused Log SDK error enum.
  • Adjust tests, examples, and changelogs to document the breaking changes.

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
opentelemetry-otlp/src/exporter/tonic/mod.rs Updated error conversions and function signatures to use ExporterBuildError.
opentelemetry-otlp/src/exporter/mod.rs Updated error handling in trait implementations and FromStr.
opentelemetry-otlp/src/exporter/http/mod.rs Switched error type to ExporterBuildError and added a TODO for thread-spawn handling.
opentelemetry-sdk/CHANGELOG.md & opentelemetry-otlp/CHANGELOG.md Documented breaking changes for the new error handling approach.
Various exporter and span modules, examples, and tests Modified build functions and tests to accommodate the updated error type.
Comments suppressed due to low confidence (1)

opentelemetry-otlp/src/exporter/http/mod.rs:171

  • Consider handling errors from thread spawning instead of using unwrap, to prevent potential panics. Propagate a proper ExporterBuildError instead of unwrapping the thread result.
.join().unwrap(), // TODO: Return ExporterBuildError::ThreadSpawnFailed
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.

Should OTLP Exporter Error enum be public and visible to the processor?
1 participant