diff --git a/opentelemetry-sdk/src/testing/trace/in_memory_exporter.rs b/opentelemetry-sdk/src/testing/trace/in_memory_exporter.rs index 0ae261916a..3645d9f6c2 100644 --- a/opentelemetry-sdk/src/testing/trace/in_memory_exporter.rs +++ b/opentelemetry-sdk/src/testing/trace/in_memory_exporter.rs @@ -22,7 +22,7 @@ use std::sync::{Arc, Mutex}; ///# async fn main() { /// let exporter = InMemorySpanExporterBuilder::new().build(); /// let provider = TracerProvider::builder() -/// .with_span_processor(BatchSpanProcessor::builder(exporter.clone(), runtime::Tokio).build()) +/// .with_span_processor(BatchSpanProcessor::builder(exporter.clone()).build()) /// .build(); /// /// global::set_tracer_provider(provider.clone()); diff --git a/opentelemetry-sdk/src/trace/mod.rs b/opentelemetry-sdk/src/trace/mod.rs index b6017ebfdd..4acf809022 100644 --- a/opentelemetry-sdk/src/trace/mod.rs +++ b/opentelemetry-sdk/src/trace/mod.rs @@ -16,6 +16,7 @@ mod span; mod span_limit; mod span_processor; #[cfg(feature = "experimental_trace_batch_span_processor_with_async_runtime")] +/// Experimental feature to use async runtime with batch span processor. pub mod span_processor_with_async_runtime; mod tracer; diff --git a/opentelemetry-sdk/src/trace/provider.rs b/opentelemetry-sdk/src/trace/provider.rs index e2f0bde216..253d76d148 100644 --- a/opentelemetry-sdk/src/trace/provider.rs +++ b/opentelemetry-sdk/src/trace/provider.rs @@ -64,9 +64,11 @@ /// ``` #[cfg(feature = "experimental_trace_batch_span_processor_with_async_runtime")] use crate::runtime::RuntimeChannel; -use crate::trace::{ - BatchSpanProcessor, Config, RandomIdGenerator, Sampler, SimpleSpanProcessor, SpanLimits, Tracer, -}; +#[cfg(feature = "experimental_trace_batch_span_processor_with_async_runtime")] +use crate::trace::span_processor_with_async_runtime::BatchSpanProcessor; +#[cfg(not(feature = "experimental_trace_batch_span_processor_with_async_runtime"))] +use crate::trace::BatchSpanProcessor; +use crate::trace::{Config, RandomIdGenerator, Sampler, SimpleSpanProcessor, SpanLimits, Tracer}; use crate::Resource; use crate::{export::trace::SpanExporter, trace::SpanProcessor}; use opentelemetry::trace::TraceError; diff --git a/opentelemetry-sdk/src/trace/span_processor.rs b/opentelemetry-sdk/src/trace/span_processor.rs index 4e04db6dc6..7bdc659939 100644 --- a/opentelemetry-sdk/src/trace/span_processor.rs +++ b/opentelemetry-sdk/src/trace/span_processor.rs @@ -371,15 +371,18 @@ pub struct BatchConfig { /// of batches. The default value is 5 seconds. pub(crate) scheduled_delay: Duration, + #[allow(dead_code)] /// The maximum number of spans to process in a single batch. If there are /// more than one batch worth of spans then it processes multiple batches /// of spans one batch after the other without any delay. The default value /// is 512. pub(crate) max_export_batch_size: usize, + #[allow(dead_code)] /// The maximum duration to export a batch of data. pub(crate) max_export_timeout: Duration, + #[allow(dead_code)] /// Maximum number of concurrent exports /// /// Limits the number of spawned tasks for exports and thus memory consumed diff --git a/opentelemetry-sdk/src/trace/span_processor_with_async_runtime.rs b/opentelemetry-sdk/src/trace/span_processor_with_async_runtime.rs index 32d6d134e0..02576e3f7d 100644 --- a/opentelemetry-sdk/src/trace/span_processor_with_async_runtime.rs +++ b/opentelemetry-sdk/src/trace/span_processor_with_async_runtime.rs @@ -56,6 +56,7 @@ use std::sync::Arc; /// use opentelemetry_sdk::{runtime, testing::trace::NoopSpanExporter, trace}; /// use opentelemetry_sdk::trace::BatchConfigBuilder; /// use std::time::Duration; +/// use opentelemetry_sdk::trace::span_processor_with_async_runtime::BatchSpanProcessor; /// /// #[tokio::main] /// async fn main() { @@ -63,7 +64,7 @@ use std::sync::Arc; /// let exporter = NoopSpanExporter::new(); /// /// // Create a batch span processor using an exporter and a runtime -/// let batch = trace::BatchSpanProcessor::builder(exporter, runtime::Tokio) +/// let batch = BatchSpanProcessor::builder(exporter, runtime::Tokio) /// .with_batch_config(BatchConfigBuilder::default().with_max_queue_size(4096).build()) /// .build(); ///