Skip to content

Commit

Permalink
Fixed incompatible install_simple with Tokio runtimes exporters
Browse files Browse the repository at this point in the history
  • Loading branch information
abdolence committed Sep 25, 2023
1 parent 88b8635 commit 6026d84
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ rsb_derive = "0.5"
tokio = { version = "1" }
tokio-stream = "0.1"
futures = "0.3"
futures-util = "0.3"
async-trait = "0.1"


Expand Down
9 changes: 6 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,15 @@ impl GcpCloudTraceExporterBuilder {
) -> Result<opentelemetry::sdk::trace::Tracer, opentelemetry::trace::TraceError> {
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(
Expand Down
2 changes: 1 addition & 1 deletion src/span_exporter.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 6026d84

Please sign in to comment.