Skip to content

Commit 5b21a5a

Browse files
committed
everywhere
1 parent 85e0472 commit 5b21a5a

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

opentelemetry-sdk/src/metrics/manual_reader.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,10 @@ impl MetricReader for ManualReader {
111111

112112
/// Closes any connections and frees any resources used by the reader.
113113
fn shutdown(&self) -> OTelSdkResult {
114-
let mut inner = self.inner.lock().map_err(|e| {
115-
OTelSdkError::InternalFailure(format!("Failed to acquire lock: {}", e))
116-
})?;
114+
let mut inner = self
115+
.inner
116+
.lock()
117+
.map_err(|e| OTelSdkError::InternalFailure(format!("Failed to acquire lock: {}", e)))?;
117118

118119
// Any future call to collect will now return an error.
119120
inner.sdk_producer = None;

opentelemetry-sdk/src/metrics/periodic_reader_with_async_runtime.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use opentelemetry::{otel_debug, otel_error};
1515

1616
use crate::runtime::Runtime;
1717
use crate::{
18-
error::{ShutdownError, ShutdownResult},
18+
error::{OtelSdkError, OtelSdkResult},
1919
metrics::{exporter::PushMetricExporter, reader::SdkProducer, MetricError, MetricResult},
2020
Resource,
2121
};
@@ -217,7 +217,7 @@ struct PeriodicReaderInner {
217217
enum Message {
218218
Export,
219219
Flush(oneshot::Sender<MetricResult<()>>),
220-
Shutdown(oneshot::Sender<ShutdownResult>),
220+
Shutdown(oneshot::Sender<OtelSdkResult>),
221221
}
222222

223223
enum ProducerOrWorker {
@@ -297,7 +297,7 @@ impl<RT: Runtime> PeriodicReaderWorker<RT> {
297297
let res = self.collect_and_export().await;
298298
let _ = self.reader.exporter.shutdown();
299299
if let Err(send_error) =
300-
ch.send(res.map_err(|e| ShutdownError::InternalFailure(e.to_string())))
300+
ch.send(res.map_err(|e| OtelSdkError::InternalFailure(e.to_string())))
301301
{
302302
otel_debug!(
303303
name: "PeriodicReader.Shutdown.SendResultError",
@@ -378,30 +378,30 @@ impl MetricReader for PeriodicReader {
378378
.and_then(|res| res)
379379
}
380380

381-
fn shutdown(&self) -> ShutdownResult {
381+
fn shutdown(&self) -> OtelSdkResult {
382382
let mut inner = self
383383
.inner
384384
.lock()
385-
.map_err(|e| ShutdownError::InternalFailure(e.to_string()))?;
385+
.map_err(|e| OtelSdkError::InternalFailure(e.to_string()))?;
386386
if inner.is_shutdown {
387-
return Err(ShutdownError::AlreadyShutdown);
387+
return Err(OtelSdkError::AlreadyShutdown);
388388
}
389389

390390
let (sender, receiver) = oneshot::channel();
391391
inner
392392
.message_sender
393393
.try_send(Message::Shutdown(sender))
394-
.map_err(|e| ShutdownError::InternalFailure(e.to_string()))?;
394+
.map_err(|e| OtelSdkError::InternalFailure(e.to_string()))?;
395395
drop(inner); // don't hold lock when blocking on future
396396

397397
let shutdown_result = futures_executor::block_on(receiver)
398-
.map_err(|err| ShutdownError::InternalFailure(err.to_string()))?;
398+
.map_err(|err| OtelSdkError::InternalFailure(err.to_string()))?;
399399

400400
// Acquire the lock again to set the shutdown flag
401401
let mut inner = self
402402
.inner
403403
.lock()
404-
.map_err(|e| ShutdownError::InternalFailure(e.to_string()))?;
404+
.map_err(|e| OtelSdkError::InternalFailure(e.to_string()))?;
405405
inner.is_shutdown = true;
406406

407407
shutdown_result

0 commit comments

Comments
 (0)