Skip to content

Commit 07f233a

Browse files
committed
chore: make 'cargo test' in the opentelemetry-sdk dir work
1 parent 796ac1a commit 07f233a

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

opentelemetry-sdk/src/logs/batch_log_processor.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ type LogsData = Box<(SdkLogRecord, InstrumentationScope)>;
104104
///
105105
/// ### Using a BatchLogProcessor:
106106
///
107-
/// ```rust
107+
/// ```
108+
/// # #[cfg(feature = "testing")]
109+
/// # {
108110
/// use opentelemetry_sdk::logs::{BatchLogProcessor, BatchConfigBuilder, SdkLoggerProvider};
109111
/// use opentelemetry::global;
110112
/// use std::time::Duration;
@@ -124,7 +126,8 @@ type LogsData = Box<(SdkLogRecord, InstrumentationScope)>;
124126
/// let provider = SdkLoggerProvider::builder()
125127
/// .with_log_processor(processor)
126128
/// .build();
127-
///
129+
/// # }
130+
/// ```
128131
pub struct BatchLogProcessor {
129132
logs_sender: SyncSender<LogsData>, // Data channel to store log records and instrumentation scopes
130133
message_sender: SyncSender<BatchMessage>, // Control channel to store control messages for the worker thread

opentelemetry-sdk/src/logs/simple_log_processor.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ use std::time::Duration;
4747
///
4848
/// ### Using a SimpleLogProcessor
4949
///
50-
/// ```rust
50+
/// ```
51+
/// # #[cfg(feature = "testing")]
52+
/// # {
5153
/// use opentelemetry_sdk::logs::{SimpleLogProcessor, SdkLoggerProvider, LogExporter};
5254
/// use opentelemetry::global;
5355
/// use opentelemetry_sdk::logs::InMemoryLogExporter;
@@ -56,7 +58,7 @@ use std::time::Duration;
5658
/// let provider = SdkLoggerProvider::builder()
5759
/// .with_simple_exporter(exporter)
5860
/// .build();
59-
///
61+
/// # }
6062
/// ```
6163
///
6264
#[derive(Debug)]

opentelemetry-sdk/src/metrics/instrument.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ impl Instrument {
134134
/// # Example
135135
///
136136
/// ```
137+
/// # #[cfg(feature = "spec_unstable_metrics_views")]
138+
/// # {
137139
/// use opentelemetry_sdk::metrics::{Aggregation, Stream};
138140
/// use opentelemetry::Key;
139141
///
@@ -143,6 +145,7 @@ impl Instrument {
143145
/// .with_cardinality_limit(100)
144146
/// .build()
145147
/// .unwrap();
148+
/// # }
146149
/// ```
147150
#[derive(Default, Debug)]
148151
pub struct StreamBuilder {

opentelemetry-sdk/src/trace/span_processor.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ impl<T: SpanExporter> SpanProcessor for SimpleSpanProcessor<T> {
194194
/// with a custom configuration. Note that a dedicated thread is used internally
195195
/// to manage the export process.
196196
///
197-
/// ```rust
197+
/// ```
198+
/// # #[cfg(all(feature = "testing", feature = "experimental_async_runtime"))]
199+
/// # {
198200
/// use opentelemetry::global;
199201
/// use opentelemetry_sdk::{
200202
/// trace::{BatchSpanProcessor, BatchConfigBuilder, SdkTracerProvider},
@@ -234,6 +236,7 @@ impl<T: SpanExporter> SpanProcessor for SimpleSpanProcessor<T> {
234236
/// // Step 5: Ensure all spans are flushed before exiting.
235237
/// provider.shutdown();
236238
/// }
239+
/// # }
237240
/// ```
238241
use std::sync::mpsc::sync_channel;
239242
use std::sync::mpsc::Receiver;

0 commit comments

Comments
 (0)