Skip to content

Commit

Permalink
cont..
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb committed Dec 22, 2024
1 parent 83f9d2e commit d41ff4d
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 33 deletions.
2 changes: 1 addition & 1 deletion examples/tracing-grpc/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn init_tracer() -> sdktrace::TracerProvider {
global::set_text_map_propagator(TraceContextPropagator::new());
// Install stdout exporter pipeline to be able to retrieve the collected spans.
let provider = sdktrace::TracerProvider::builder()
.with_batch_exporter(SpanExporter::default(), Tokio)
.with_batch_exporter(SpanExporter::default())
.build();

global::set_tracer_provider(provider.clone());
Expand Down
2 changes: 1 addition & 1 deletion examples/tracing-grpc/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn init_tracer() -> TracerProvider {
global::set_text_map_propagator(TraceContextPropagator::new());
// Install stdout exporter pipeline to be able to retrieve the collected spans.
let provider = TracerProvider::builder()
.with_batch_exporter(SpanExporter::default(), Tokio)
.with_batch_exporter(SpanExporter::default())
.build();

global::set_tracer_provider(provider.clone());
Expand Down
2 changes: 1 addition & 1 deletion examples/tracing-jaeger/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn init_tracer_provider() -> Result<opentelemetry_sdk::trace::TracerProvider, Tr
.build()?;

Ok(TracerProvider::builder()
.with_batch_exporter(exporter, runtime::Tokio)
.with_batch_exporter(exporter)
.with_resource(
Resource::builder()
.with_service_name("tracing-jaeger")
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-otlp/examples/basic-otlp/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn init_traces() -> Result<sdktrace::TracerProvider, TraceError> {
.build()?;
Ok(sdktrace::TracerProvider::builder()
.with_resource(RESOURCE.clone())
.with_batch_exporter(exporter, runtime::Tokio)
.with_batch_exporter(exporter)
.build())
}

Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-otlp/tests/integration_test/tests/traces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn init_tracer_provider() -> Result<sdktrace::TracerProvider, TraceError> {
let exporter = exporter_builder.build()?;

Ok(opentelemetry_sdk::trace::TracerProvider::builder()
.with_batch_exporter(exporter, runtime::Tokio)
.with_batch_exporter(exporter)
.with_resource(
Resource::builder_empty()
.with_service_name("basic-otlp-tracing-example")
Expand Down
1 change: 0 additions & 1 deletion opentelemetry-otlp/tests/smoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ async fn smoke_tracer() {
.with_metadata(metadata)
.build()
.expect("NON gzip-tonic SpanExporter failed to build"),
opentelemetry_sdk::runtime::Tokio,
)
.build();

Expand Down
22 changes: 3 additions & 19 deletions opentelemetry-sdk/src/trace/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,9 @@
/// provider.shutdown();
/// }
/// ```
#[cfg(feature = "experimental_trace_batch_span_processor_with_async_runtime")]
use crate::runtime::RuntimeChannel;
#[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::trace::{
BatchSpanProcessor, Config, RandomIdGenerator, Sampler, SimpleSpanProcessor, SpanLimits, Tracer,
};
use crate::Resource;
use crate::{export::trace::SpanExporter, trace::SpanProcessor};
use opentelemetry::trace::TraceError;
Expand Down Expand Up @@ -298,18 +294,6 @@ impl Builder {
Builder { processors, ..self }
}

#[cfg(feature = "experimental_trace_batch_span_processor_with_async_runtime")]
/// The [`SpanExporter`] setup using a default [`BatchSpanProcessor`] that this provider should use.
pub fn with_batch_exporter<T: SpanExporter + 'static, R: RuntimeChannel>(
self,
exporter: T,
runtime: R,
) -> Self {
let batch = BatchSpanProcessor::builder(exporter, runtime).build();
self.with_span_processor(batch)
}

#[cfg(not(feature = "experimental_trace_batch_span_processor_with_async_runtime"))]
/// The [`SpanExporter`] setup using a default [`BatchSpanProcessor`] that this provider should use.
pub fn with_batch_exporter<T: SpanExporter + 'static>(self, exporter: T) -> Self {
let batch = BatchSpanProcessor::builder(exporter).build();

Check warning on line 299 in opentelemetry-sdk/src/trace/provider.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/trace/provider.rs#L298-L299

Added lines #L298 - L299 were not covered by tests
Expand Down
7 changes: 5 additions & 2 deletions opentelemetry-sdk/src/trace/runtime_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,18 @@ impl SpanCountExporter {
}
}

#[cfg(feature = "experimental_trace_batch_span_processor_with_async_runtime")]
#[cfg(any(feature = "rt-tokio", feature = "rt-tokio-current-thread"))]
fn build_batch_tracer_provider<R: RuntimeChannel>(
exporter: SpanCountExporter,
runtime: R,
) -> crate::trace::TracerProvider {
use crate::trace::TracerProvider;
let processor = crate::trace::span_processor_with_async_runtime::BatchSpanProcessor::builder(
exporter, runtime,
)
.build();

Check warning on line 58 in opentelemetry-sdk/src/trace/runtime_tests.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/trace/runtime_tests.rs#L55-L58

Added lines #L55 - L58 were not covered by tests
TracerProvider::builder()
.with_batch_exporter(exporter, runtime)
.with_span_processor(processor)

Check warning on line 60 in opentelemetry-sdk/src/trace/runtime_tests.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/trace/runtime_tests.rs#L60

Added line #L60 was not covered by tests
.build()
}

Expand Down
3 changes: 1 addition & 2 deletions opentelemetry-sdk/src/trace/span_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -720,8 +720,7 @@ mod tests {

use futures_util::future::BoxFuture;
use futures_util::FutureExt;
use std::sync::Arc;
use std::sync::Mutex;
use std::sync::{Arc, Mutex};

// Mock exporter to test functionality
#[derive(Debug)]
Expand Down
6 changes: 2 additions & 4 deletions opentelemetry-zipkin/src/exporter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use opentelemetry_http::HttpClient;
use opentelemetry_sdk::{
export::{trace, ExportError},
resource::{ResourceDetector, SdkProvidedResourceDetector},
runtime::RuntimeChannel,
trace::{Config, Tracer, TracerProvider},
Resource,
};
Expand Down Expand Up @@ -165,13 +164,12 @@ impl ZipkinPipelineBuilder {
/// Install the Zipkin trace exporter pipeline with a batch span processor using the specified
/// runtime.
#[allow(deprecated)]
pub fn install_batch<R: RuntimeChannel>(
pub fn install_batch(

Check warning on line 167 in opentelemetry-zipkin/src/exporter/mod.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-zipkin/src/exporter/mod.rs#L167

Added line #L167 was not covered by tests
mut self,
runtime: R,
) -> Result<(Tracer, opentelemetry_sdk::trace::TracerProvider), TraceError> {
let (config, endpoint) = self.init_config_and_endpoint();
let exporter = self.init_exporter_with_endpoint(endpoint)?;
let mut provider_builder = TracerProvider::builder().with_batch_exporter(exporter, runtime);
let mut provider_builder = TracerProvider::builder().with_batch_exporter(exporter);

Check warning on line 172 in opentelemetry-zipkin/src/exporter/mod.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-zipkin/src/exporter/mod.rs#L172

Added line #L172 was not covered by tests
provider_builder = provider_builder.with_config(config);
let provider = provider_builder.build();
let scope = InstrumentationScope::builder("opentelemetry-zipkin")
Expand Down

0 comments on commit d41ff4d

Please sign in to comment.