From 65b286fdf3b9078d7632f31d821013054d233da2 Mon Sep 17 00:00:00 2001 From: Alan West <3676547+alanwest@users.noreply.github.com> Date: Mon, 30 Sep 2024 15:33:14 -0700 Subject: [PATCH] Fix Rust example (#681) * Update to actix-web-opentelemetry v0.19.0 * Use TokioCurrentThread to make ctrl-c work --- getting-started-guides/rust/Cargo.lock | 32 +++++++------------------ getting-started-guides/rust/Cargo.toml | 4 ++-- getting-started-guides/rust/src/main.rs | 2 +- 3 files changed, 12 insertions(+), 26 deletions(-) diff --git a/getting-started-guides/rust/Cargo.lock b/getting-started-guides/rust/Cargo.lock index 9ebff298..e098607d 100644 --- a/getting-started-guides/rust/Cargo.lock +++ b/getting-started-guides/rust/Cargo.lock @@ -186,14 +186,14 @@ dependencies = [ [[package]] name = "actix-web-opentelemetry" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "923b53a2a54dd0b6fb3e737a036b497321b693d16c120806ba4009478f06109b" +checksum = "4c72677f49b2d25f10bb235d7db8e2f6688b6180e2ccde0f0be63894492b326d" dependencies = [ "actix-http", "actix-web", "futures-util", - "opentelemetry 0.23.0", + "opentelemetry", "opentelemetry-semantic-conventions", "serde", ] @@ -568,7 +568,7 @@ version = "0.1.0" dependencies = [ "actix-web", "actix-web-opentelemetry", - "opentelemetry 0.24.0", + "opentelemetry", "opentelemetry-otlp", "opentelemetry_sdk", "serde", @@ -1039,20 +1039,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "opentelemetry" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b69a91d4893e713e06f724597ad630f1fa76057a5e1026c0ca67054a9032a76" -dependencies = [ - "futures-core", - "futures-sink", - "js-sys", - "once_cell", - "pin-project-lite", - "thiserror", -] - [[package]] name = "opentelemetry" version = "0.24.0" @@ -1076,7 +1062,7 @@ dependencies = [ "async-trait", "futures-core", "http 1.1.0", - "opentelemetry 0.24.0", + "opentelemetry", "opentelemetry-proto", "opentelemetry_sdk", "prost", @@ -1091,7 +1077,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30ee9f20bff9c984511a02f082dc8ede839e4a9bf15cc2487c8d6fea5ad850d9" dependencies = [ - "opentelemetry 0.24.0", + "opentelemetry", "opentelemetry_sdk", "prost", "tonic", @@ -1099,9 +1085,9 @@ dependencies = [ [[package]] name = "opentelemetry-semantic-conventions" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1869fb4bb9b35c5ba8a1e40c9b128a7b4c010d07091e864a29da19e4fe2ca4d7" +checksum = "1cefe0543875379e47eb5f1e68ff83f45cc41366a92dfd0d073d513bf68e9a05" [[package]] name = "opentelemetry_sdk" @@ -1115,7 +1101,7 @@ dependencies = [ "futures-util", "glob", "once_cell", - "opentelemetry 0.24.0", + "opentelemetry", "percent-encoding", "rand", "serde_json", diff --git a/getting-started-guides/rust/Cargo.toml b/getting-started-guides/rust/Cargo.toml index 7570d3d6..6ff3f895 100644 --- a/getting-started-guides/rust/Cargo.toml +++ b/getting-started-guides/rust/Cargo.toml @@ -5,9 +5,9 @@ edition = "2021" [dependencies] actix-web = "4.8.0" -actix-web-opentelemetry = "0.18.0" +actix-web-opentelemetry = "0.19.0" opentelemetry = "0.24.0" opentelemetry-otlp = { version = "0.17.0", features = ["tls-roots", "gzip-tonic"] } -opentelemetry_sdk = { version = "0.24.1", features = ["rt-tokio"] } +opentelemetry_sdk = { version = "0.24.1", features = ["rt-tokio-current-thread"] } serde = { version = "1.0.205", features = ["derive"] } tonic = "0.12.1" diff --git a/getting-started-guides/rust/src/main.rs b/getting-started-guides/rust/src/main.rs index 7a95777a..59754b83 100644 --- a/getting-started-guides/rust/src/main.rs +++ b/getting-started-guides/rust/src/main.rs @@ -94,7 +94,7 @@ async fn main() -> std::io::Result<()> { .with_exporter(opentelemetry_otlp::new_exporter().tonic() .with_tls_config(tonic::transport::ClientTlsConfig::new().with_native_roots())) .with_trace_config(Config::default().with_resource(resource)) - .install_batch(runtime::Tokio) + .install_batch(runtime::TokioCurrentThread) .expect("failed to initialize the trace pipeline"); global::set_tracer_provider(tracer_provider);