Skip to content

Commit ef87ca7

Browse files
committed
Address review comments
1 parent 2df2353 commit ef87ca7

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

opentelemetry-sdk/CHANGELOG.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
[#2338](https://github.com/open-telemetry/opentelemetry-rust/pull/2338)
1111
- `ResourceDetector.detect()` no longer supports timeout option.
1212
- `opentelemetry::global::shutdown_tracer_provider()` Removed from the API, should now use `tracer_provider.shutdown()` see [#2369](https://github.com/open-telemetry/opentelemetry-rust/pull/2369) for a migration example. "Tracer provider" is cheaply cloneable, so users are encouraged to set a clone of it as the global (ex: `global::set_tracer_provider(provider.clone()))`, so that instrumentations and other components can obtain tracers from `global::tracer()`. The tracer_provider must be kept around to call shutdown on it at the end of application (ex: `tracer_provider.shutdown()`)
13-
- The trait functions `LogExporter.shutdown` and `TraceExporter.shutdown` now explicitly return a result. The
14-
semantics of the method have not changed, but you will have a new lint encouraging you to consume these results.
15-
13+
- If you are an exporter author, the trait functions `LogExporter.shutdown` and `TraceExporter.shutdown` must now return a result. Note that implementing shutdown is optional as the trait provides a default implementation that returns Ok(()).
14+
1615
## 0.27.1
1716

1817
Released 2024-Nov-27

opentelemetry-sdk/src/export/trace.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ use std::borrow::Cow;
77
use std::fmt::Debug;
88
use std::time::SystemTime;
99

10-
/// Describes the result of an export.
11-
pub type ExportResult = Result<(), TraceError>;
12-
1310
/// Describes the results of other operations on the trace API.
1411
pub type TraceResult<T> = Result<T, TraceError>;
1512

13+
/// Describes the results of an export
14+
/// Note: This is an alias we will remove in the future, favouring
15+
/// using TraceResult directly.
16+
pub type ExportResult = TraceResult<()>;
17+
1618
/// `SpanExporter` defines the interface that protocol-specific exporters must
1719
/// implement so that they can be plugged into OpenTelemetry SDK and support
1820
/// sending of telemetry data.
@@ -33,7 +35,7 @@ pub trait SpanExporter: Send + Sync + Debug {
3335
///
3436
/// Any retry logic that is required by the exporter is the responsibility
3537
/// of the exporter.
36-
fn export(&mut self, batch: Vec<SpanData>) -> BoxFuture<'static, ExportResult>;
38+
fn export(&mut self, batch: Vec<SpanData>) -> BoxFuture<'static, TraceResult<()>>;
3739

3840
/// Shuts down the exporter. Called when SDK is shut down. This is an
3941
/// opportunity for exporter to do any cleanup required.

opentelemetry-sdk/src/logs/log_processor.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -596,10 +596,6 @@ mod tests {
596596
Ok(())
597597
}
598598

599-
fn shutdown(&mut self) -> LogResult<()> {
600-
Ok(())
601-
}
602-
603599
fn set_resource(&mut self, resource: &Resource) {
604600
self.resource
605601
.lock()

0 commit comments

Comments
 (0)