diff --git a/Cargo.toml b/Cargo.toml index c7b638f..599a8aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,9 +22,9 @@ path = "src/lib.rs" [dependencies] tracing = "0.1" -opentelemetry = { version = "0.26" } -opentelemetry_sdk = { version = "0.26", features = ["rt-tokio"] } -opentelemetry-semantic-conventions = { version = "0.26" } +opentelemetry = { version = "0.27" } +opentelemetry_sdk = { version = "0.27", features = ["rt-tokio"] } +opentelemetry-semantic-conventions = { version = "0.27" } gcloud-sdk = { version = "0.25", features = ["google-devtools-cloudtrace-v2"], default-features = false } rvstruct = "0.3" rsb_derive = "0.5" @@ -40,8 +40,8 @@ tls-webpki-roots = ["gcloud-sdk/tls-webpki-roots"] [dev-dependencies] tokio = { version = "1", features = ["full"] } -opentelemetry = { version = "0.26" } +opentelemetry = { version = "0.27" } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter","registry"] } -tracing-opentelemetry = { version = "0.27" } +tracing-opentelemetry = { version = "0.28" } cargo-husky = { version = "1.5", default-features = false, features = ["run-for-all", "prepush-hook", "run-cargo-fmt"] } diff --git a/src/errors.rs b/src/errors.rs index dd7a064..e32b67c 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -1,5 +1,5 @@ use gcloud_sdk::error::Error; -use opentelemetry::ExportError; +use opentelemetry::trace::ExportError; use rsb_derive::*; pub type BoxedError = Box; diff --git a/src/google_trace_exporter_client.rs b/src/google_trace_exporter_client.rs index b0104f8..f4e279e 100644 --- a/src/google_trace_exporter_client.rs +++ b/src/google_trace_exporter_client.rs @@ -142,6 +142,10 @@ impl GcpCloudTraceExporterClient { MAX_STR_LEN, )) } + _ => gcp_attribute_value::Value::StringValue(Self::truncatable_string( + "unknown_value", + MAX_STR_LEN, + )), }), } } diff --git a/src/lib.rs b/src/lib.rs index 7f1ceb8..d5c0a2e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -41,11 +41,11 @@ pub type TraceExportResult = Result; mod google_trace_exporter_client; mod span_exporter; -use std::ops::Deref; - use opentelemetry::trace::TracerProvider; +use opentelemetry::InstrumentationScope; use opentelemetry_sdk::Resource; pub use span_exporter::GcpCloudTraceExporter; +use std::ops::Deref; use rsb_derive::*; @@ -107,12 +107,13 @@ impl GcpCloudTraceExporterBuilder { .build() }; - let tracer = provider - .tracer_builder("opentelemetry-gcloud") + let scope = InstrumentationScope::builder("opentelemetry-gcloud") .with_version(env!("CARGO_PKG_VERSION")) .with_schema_url("https://opentelemetry.io/schemas/1.23.0") .build(); + let tracer = provider.tracer_with_scope(scope); + let _ = opentelemetry::global::set_tracer_provider(provider); Ok(tracer) }