diff --git a/Cargo.toml b/Cargo.toml index fa43e00..2a2a963 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,12 +32,11 @@ rsb_derive = "0.5" tokio = { version = "1" } tokio-stream = "0.1" futures = "0.3" -futures-util = "0.3" async-trait = "0.1" [dev-dependencies] -tokio = { version = "1", features = ["full"] } +tokio = { version = "1.29", features = ["full"] } opentelemetry = { version = "0.20", features = ["rt-tokio"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter","registry"] } diff --git a/src/lib.rs b/src/lib.rs index d1841f5..e61c768 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -69,12 +69,15 @@ impl GcpCloudTraceExporterBuilder { ) -> Result { let exporter = GcpCloudTraceExporter::new(&self.google_project_id).await?; - let mut provider_builder = - opentelemetry::sdk::trace::TracerProvider::builder().with_simple_exporter(exporter); + let mut provider_builder = opentelemetry::sdk::trace::TracerProvider::builder() + .with_batch_exporter(exporter, opentelemetry::runtime::Tokio); provider_builder = if let Some(config) = self.trace_config { provider_builder.with_config(config) } else { - provider_builder + provider_builder.with_config( + opentelemetry::sdk::trace::config() + .with_sampler(opentelemetry::sdk::trace::Sampler::AlwaysOn), + ) }; let provider = provider_builder.build(); let tracer = provider.versioned_tracer( diff --git a/src/span_exporter.rs b/src/span_exporter.rs index ee86b3d..09a8f2a 100644 --- a/src/span_exporter.rs +++ b/src/span_exporter.rs @@ -1,7 +1,7 @@ use crate::errors::*; use crate::google_trace_exporter_client::GcpCloudTraceExporterClient; use crate::TraceExportResult; -use futures_util::future::{BoxFuture, TryFutureExt}; +use futures::future::{BoxFuture, TryFutureExt}; use gcloud_sdk::GoogleEnvironment; use opentelemetry::sdk::export::trace::{ExportResult, SpanData, SpanExporter}; use std::fmt::Formatter;