Skip to content

Commit 7b852ad

Browse files
committed
add feature flag
1 parent 00b3122 commit 7b852ad

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

opentelemetry-sdk/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ rt-tokio = ["tokio", "tokio-stream"]
5353
rt-tokio-current-thread = ["tokio", "tokio-stream"]
5454
rt-async-std = ["async-std"]
5555
internal-logs = ["tracing"]
56+
experimental_metrics_periodic_reader_no_runtime = ["metrics"]
5657

5758
[[bench]]
5859
name = "context"

opentelemetry-sdk/src/metrics/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pub(crate) mod meter;
5050
mod meter_provider;
5151
pub(crate) mod noop;
5252
pub(crate) mod periodic_reader;
53+
#[cfg(feature = "experimental_metrics_periodic_reader_no_runtime")]
5354
pub(crate) mod periodic_reader_with_own_thread;
5455
pub(crate) mod pipeline;
5556
pub mod reader;
@@ -61,6 +62,7 @@ pub use instrument::*;
6162
pub use manual_reader::*;
6263
pub use meter_provider::*;
6364
pub use periodic_reader::*;
65+
#[cfg(feature = "experimental_metrics_periodic_reader_no_runtime")]
6466
pub use periodic_reader_with_own_thread::*;
6567
pub use pipeline::Pipeline;
6668
pub use view::*;

opentelemetry-sdk/src/metrics/periodic_reader_with_own_thread.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,8 @@ impl PeriodicReaderInner {
355355
// take arbitrary time.
356356
//
357357
// Relying on futures executor to execute async call.
358-
// TODO: Add timeout and pass it to exporter.
358+
// TODO: Add timeout and pass it to exporter or consider alternative
359+
// design to enforce timeout here.
359360
let exporter_result = futures_executor::block_on(self.exporter.export(&mut rm));
360361
#[allow(clippy::question_mark)]
361362
if let Err(e) = exporter_result {
@@ -392,6 +393,7 @@ impl PeriodicReaderInner {
392393
}
393394

394395
if let Ok(response) = response_rx.recv() {
396+
// TODO: call exporter's force_flush method.
395397
if response {
396398
Ok(())
397399
} else {
@@ -502,7 +504,7 @@ mod tests {
502504
};
503505

504506
// use below command to run all tests
505-
// cargo test metrics::periodic_reader_with_own_thread::tests --features=testing -- --nocapture
507+
// cargo test metrics::periodic_reader_with_own_thread::tests --features=testing,experimental_metrics_periodic_reader_no_runtime -- --nocapture
506508

507509
#[derive(Debug, Clone)]
508510
struct MetricExporterThatFailsOnlyOnFirst {

0 commit comments

Comments
 (0)