@@ -244,25 +244,25 @@ where
244244 // Visit fields.
245245 event. record ( & mut visitor) ;
246246
247- #[ cfg( feature = "experimental_use_tracing_span_context" ) ]
248- if let Some ( span) = _ctx. event_span ( event) {
249- use tracing_opentelemetry:: OtelData ;
250- let opt_span_id = span
251- . extensions ( )
252- . get :: < OtelData > ( )
253- . and_then ( |otd| otd. builder . span_id ) ;
254-
255- let opt_trace_id = span. scope ( ) . last ( ) . and_then ( |root_span| {
256- root_span
257- . extensions ( )
258- . get :: < OtelData > ( )
259- . and_then ( |otd| otd. builder . trace_id )
260- } ) ;
261-
262- if let Some ( ( trace_id, span_id) ) = opt_trace_id. zip ( opt_span_id) {
263- log_record. set_trace_context ( trace_id, span_id, None ) ;
264- }
265- }
247+ // #[cfg(feature = "experimental_use_tracing_span_context")]
248+ // if let Some(span) = _ctx.event_span(event) {
249+ // use tracing_opentelemetry::OtelData;
250+ // let opt_span_id = span
251+ // .extensions()
252+ // .get::<OtelData>()
253+ // .and_then(|otd| otd.builder.span_id);
254+
255+ // let opt_trace_id = span.scope().last().and_then(|root_span| {
256+ // root_span
257+ // .extensions()
258+ // .get::<OtelData>()
259+ // .and_then(|otd| otd.builder.trace_id)
260+ // });
261+
262+ // if let Some((trace_id, span_id)) = opt_trace_id.zip(opt_span_id) {
263+ // log_record.set_trace_context(trace_id, span_id, None);
264+ // }
265+ // }
266266
267267 //emit record
268268 self . logger . emit ( log_record) ;
@@ -673,66 +673,66 @@ mod tests {
673673 }
674674 }
675675
676- #[ cfg( feature = "experimental_use_tracing_span_context" ) ]
677- #[ test]
678- fn tracing_appender_inside_tracing_crate_context ( ) {
679- use opentelemetry_sdk:: trace:: InMemorySpanExporterBuilder ;
676+ // #[cfg(feature = "experimental_use_tracing_span_context")]
677+ // #[test]
678+ // fn tracing_appender_inside_tracing_crate_context() {
679+ // use opentelemetry_sdk::trace::InMemorySpanExporterBuilder;
680680
681- // Arrange
682- let exporter: InMemoryLogExporter = InMemoryLogExporter :: default ( ) ;
683- let logger_provider = SdkLoggerProvider :: builder ( )
684- . with_simple_exporter ( exporter. clone ( ) )
685- . build ( ) ;
681+ // // Arrange
682+ // let exporter: InMemoryLogExporter = InMemoryLogExporter::default();
683+ // let logger_provider = SdkLoggerProvider::builder()
684+ // .with_simple_exporter(exporter.clone())
685+ // .build();
686686
687- // setup tracing layer to compare trace/span IDs against
688- let span_exporter = InMemorySpanExporterBuilder :: new ( ) . build ( ) ;
689- let tracer_provider = SdkTracerProvider :: builder ( )
690- . with_simple_exporter ( span_exporter. clone ( ) )
691- . build ( ) ;
692- let tracer = tracer_provider. tracer ( "test-tracer" ) ;
687+ // // setup tracing layer to compare trace/span IDs against
688+ // let span_exporter = InMemorySpanExporterBuilder::new().build();
689+ // let tracer_provider = SdkTracerProvider::builder()
690+ // .with_simple_exporter(span_exporter.clone())
691+ // .build();
692+ // let tracer = tracer_provider.tracer("test-tracer");
693693
694- let level_filter = tracing_subscriber:: filter:: LevelFilter :: ERROR ;
695- let log_layer =
696- layer:: OpenTelemetryTracingBridge :: new ( & logger_provider) . with_filter ( level_filter) ;
694+ // let level_filter = tracing_subscriber::filter::LevelFilter::ERROR;
695+ // let log_layer =
696+ // layer::OpenTelemetryTracingBridge::new(&logger_provider).with_filter(level_filter);
697697
698- let subscriber = tracing_subscriber:: registry ( )
699- . with ( log_layer)
700- . with ( tracing_opentelemetry:: layer ( ) . with_tracer ( tracer) ) ;
698+ // let subscriber = tracing_subscriber::registry()
699+ // .with(log_layer)
700+ // .with(tracing_opentelemetry::layer().with_tracer(tracer));
701701
702- // Avoiding global subscriber.init() as that does not play well with unit tests.
703- let _guard = tracing:: subscriber:: set_default ( subscriber) ;
702+ // // Avoiding global subscriber.init() as that does not play well with unit tests.
703+ // let _guard = tracing::subscriber::set_default(subscriber);
704704
705- // Act
706- tracing:: error_span!( "outer-span" ) . in_scope ( || {
707- error ! ( "first-event" ) ;
705+ // // Act
706+ // tracing::error_span!("outer-span").in_scope(|| {
707+ // error!("first-event");
708708
709- tracing:: error_span!( "inner-span" ) . in_scope ( || {
710- error ! ( "second-event" ) ;
711- } ) ;
712- } ) ;
709+ // tracing::error_span!("inner-span").in_scope(|| {
710+ // error!("second-event");
711+ // });
712+ // });
713713
714- assert ! ( logger_provider. force_flush( ) . is_ok( ) ) ;
714+ // assert!(logger_provider.force_flush().is_ok());
715715
716- let logs = exporter. get_emitted_logs ( ) . expect ( "No emitted logs" ) ;
717- assert_eq ! ( logs. len( ) , 2 , "Expected 2 logs, got: {logs:?}" ) ;
716+ // let logs = exporter.get_emitted_logs().expect("No emitted logs");
717+ // assert_eq!(logs.len(), 2, "Expected 2 logs, got: {logs:?}");
718718
719- let spans = span_exporter. get_finished_spans ( ) . unwrap ( ) ;
720- assert_eq ! ( spans. len( ) , 2 ) ;
719+ // let spans = span_exporter.get_finished_spans().unwrap();
720+ // assert_eq!(spans.len(), 2);
721721
722- let trace_id = spans[ 0 ] . span_context . trace_id ( ) ;
723- assert_eq ! ( trace_id, spans[ 1 ] . span_context. trace_id( ) ) ;
724- let inner_span_id = spans[ 0 ] . span_context . span_id ( ) ;
725- let outer_span_id = spans[ 1 ] . span_context . span_id ( ) ;
726- assert_eq ! ( outer_span_id, spans[ 0 ] . parent_span_id) ;
722+ // let trace_id = spans[0].span_context.trace_id();
723+ // assert_eq!(trace_id, spans[1].span_context.trace_id());
724+ // let inner_span_id = spans[0].span_context.span_id();
725+ // let outer_span_id = spans[1].span_context.span_id();
726+ // assert_eq!(outer_span_id, spans[0].parent_span_id);
727727
728- let trace_ctx0 = logs[ 0 ] . record . trace_context ( ) . unwrap ( ) ;
729- let trace_ctx1 = logs[ 1 ] . record . trace_context ( ) . unwrap ( ) ;
728+ // let trace_ctx0 = logs[0].record.trace_context().unwrap();
729+ // let trace_ctx1 = logs[1].record.trace_context().unwrap();
730730
731- assert_eq ! ( trace_ctx0. trace_id, trace_id) ;
732- assert_eq ! ( trace_ctx1. trace_id, trace_id) ;
733- assert_eq ! ( trace_ctx0. span_id, outer_span_id) ;
734- assert_eq ! ( trace_ctx1. span_id, inner_span_id) ;
735- }
731+ // assert_eq!(trace_ctx0.trace_id, trace_id);
732+ // assert_eq!(trace_ctx1.trace_id, trace_id);
733+ // assert_eq!(trace_ctx0.span_id, outer_span_id);
734+ // assert_eq!(trace_ctx1.span_id, inner_span_id);
735+ // }
736736
737737 #[ test]
738738 fn tracing_appender_standalone_with_tracing_log ( ) {
0 commit comments