From cd1f4559f2808d5e28d0a623839966351fbf531b Mon Sep 17 00:00:00 2001 From: Benjamin Pannell Date: Wed, 6 Dec 2023 13:40:39 +0000 Subject: [PATCH] chore: Update to the latest version of OpenTelemetry --- Cargo.lock | 107 +++++++++++++++++++++++-------------------- Cargo.toml | 11 +++-- src/main.rs | 2 +- src/telemetry/mod.rs | 6 +-- src/update/cmd.rs | 2 +- 5 files changed, 68 insertions(+), 60 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c544d131..e5fbd7cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -888,6 +888,7 @@ dependencies = [ "once_cell", "opentelemetry", "opentelemetry-otlp", + "opentelemetry_sdk", "reqwest", "rpassword", "semver", @@ -907,6 +908,12 @@ dependencies = [ "trust-dns-resolver", ] +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + [[package]] name = "gtmpl" version = "0.7.1" @@ -1541,26 +1548,32 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "opentelemetry" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9591d937bc0e6d2feb6f71a559540ab300ea49955229c347a517a28d27784c54" +checksum = "1e32339a5dc40459130b3bd269e9892439f55b33e772d2a9d402a789baaf4e8a" dependencies = [ - "opentelemetry_api", - "opentelemetry_sdk", + "futures-core", + "futures-sink", + "indexmap 2.0.2", + "js-sys", + "once_cell", + "pin-project-lite", + "thiserror", + "urlencoding", ] [[package]] name = "opentelemetry-otlp" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e5e5a5c4135864099f3faafbe939eb4d7f9b80ebf68a8448da961b32a7c1275" +checksum = "f24cda83b20ed2433c68241f918d0f6fdec8b1d43b7a9590ab4420c5095ca930" dependencies = [ "async-trait", "futures-core", "http", + "opentelemetry", "opentelemetry-proto", "opentelemetry-semantic-conventions", - "opentelemetry_api", "opentelemetry_sdk", "prost", "thiserror", @@ -1570,11 +1583,11 @@ dependencies = [ [[package]] name = "opentelemetry-proto" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e3f814aa9f8c905d0ee4bde026afd3b2577a97c10e1699912e3e44f0c4cbeb" +checksum = "a2e155ce5cc812ea3d1dffbd1539aed653de4bf4882d60e6e04dcf0901d674e1" dependencies = [ - "opentelemetry_api", + "opentelemetry", "opentelemetry_sdk", "prost", "tonic", @@ -1582,47 +1595,30 @@ dependencies = [ [[package]] name = "opentelemetry-semantic-conventions" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73c9f9340ad135068800e7f1b24e9e09ed9e7143f5bf8518ded3d3ec69789269" +checksum = "f5774f1ef1f982ef2a447f6ee04ec383981a3ab99c8e77a1a7b30182e65bbc84" dependencies = [ "opentelemetry", ] -[[package]] -name = "opentelemetry_api" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a81f725323db1b1206ca3da8bb19874bbd3f57c3bcd59471bfb04525b265b9b" -dependencies = [ - "futures-channel", - "futures-util", - "indexmap 1.9.3", - "js-sys", - "once_cell", - "pin-project-lite", - "thiserror", - "urlencoding", -] - [[package]] name = "opentelemetry_sdk" -version = "0.20.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa8e705a0612d48139799fcbaba0d4a90f06277153e43dd2bdc16c6f0edd8026" +checksum = "968ba3f2ca03e90e5187f5e4f46c791ef7f2c163ae87789c8ce5f5ca3b7b7de5" dependencies = [ "async-trait", "crossbeam-channel", "futures-channel", "futures-executor", "futures-util", + "glob", "once_cell", - "opentelemetry_api", + "opentelemetry", "ordered-float", "percent-encoding", "rand", - "regex", - "serde_json", "thiserror", "tokio", "tokio-stream", @@ -1630,9 +1626,9 @@ dependencies = [ [[package]] name = "ordered-float" -version = "3.9.1" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a54938017eacd63036332b4ae5c8a49fc8c0c1d6d629893057e4f13609edd06" +checksum = "a76df7075c7d4d01fdcb46c912dd17fba5b60c78ea480b475f2b6ab6f666584e" dependencies = [ "num-traits", ] @@ -2722,22 +2718,21 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "log", "pin-project-lite", - "tracing-attributes 0.1.26", + "tracing-attributes 0.1.27", "tracing-core", ] [[package]] name = "tracing-attributes" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", @@ -2756,9 +2751,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -2778,21 +2773,22 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" dependencies = [ - "lazy_static", "log", + "once_cell", "tracing-core", ] [[package]] name = "tracing-opentelemetry" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75327c6b667828ddc28f5e3f169036cb793c3f588d83bf0f262a7f062ffed3c8" +checksum = "c67ac25c5407e7b961fafc6f7e9aa5958fd297aada2d20fa2ae1737357e55596" dependencies = [ + "js-sys", "once_cell", "opentelemetry", "opentelemetry_sdk", @@ -2801,13 +2797,14 @@ dependencies = [ "tracing-core", "tracing-log", "tracing-subscriber", + "web-time", ] [[package]] name = "tracing-subscriber" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ "nu-ansi-term", "sharded-slab", @@ -3088,6 +3085,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57099a701fb3a8043f993e8228dc24229c7b942e2b009a1b962e54489ba1d3bf" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "webpki-roots" version = "0.25.2" diff --git a/Cargo.toml b/Cargo.toml index d3356ea6..c9b2d093 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,8 +22,9 @@ itertools = "0.12" keyring = { version = "2.1", optional = true } lazy_static = "1.4" nix = { version = "0.27.1", features = ["process", "signal"] } -opentelemetry = { version = "0.20", features = ["rt-tokio"] } -opentelemetry-otlp = { version = "0.13", features = ["tls-roots"] } +opentelemetry = { version = "0.21" } +opentelemetry_sdk = { version = "0.21", features = ["rt-tokio"] } +opentelemetry-otlp = { version = "0.14", features = ["tls-roots"] } once_cell = "1.18" rpassword = { version = "7.3", optional = true } reqwest = { version = "0.11.22", default-features = false, features = ["rustls-tls", "json", "stream"] } @@ -35,11 +36,11 @@ serde_yaml = "0.9" shell-words = "1.1" tokio = { version = "1.34", features = ["rt", "time", "fs", "process", "macros", "signal"] } tonic = { version = "0.9.2", features = ["tls-roots"] } -tracing = { version = "0.1.37", features = ["log"] } +tracing = { version = "0.1.40", features = ["log"] } tracing-attributes = { git="https://github.com/SierraSoftworks/tracing.git" } tracing-futures = { version = "0.2.5", features = ["futures-03"] } -tracing-opentelemetry = "0.21" -tracing-subscriber = { version = "0.3.17", features = ["tracing-log"] } +tracing-opentelemetry = "0.22" +tracing-subscriber = { version = "0.3.18", features = ["tracing-log"] } trust-dns-resolver = { version = "0.23", features = ["tokio-runtime"] } [dev-dependencies] diff --git a/src/main.rs b/src/main.rs index bd308ad2..8c1b4d75 100644 --- a/src/main.rs +++ b/src/main.rs @@ -292,7 +292,7 @@ async fn run(matches: clap::ArgMatches) -> Result { fn load_trace_context(span: &tracing::Span, context: &str) { let carrier: std::collections::HashMap = serde_json::from_str(context).unwrap_or_default(); - let propagator = opentelemetry::sdk::propagation::TraceContextPropagator::new(); + let propagator = opentelemetry_sdk::propagation::TraceContextPropagator::new(); let parent_context = propagator.extract(&carrier); span.set_parent(parent_context); } diff --git a/src/telemetry/mod.rs b/src/telemetry/mod.rs index d12e2f1e..9ad0a21e 100644 --- a/src/telemetry/mod.rs +++ b/src/telemetry/mod.rs @@ -66,15 +66,15 @@ impl Session { .with_endpoint("https://api.honeycomb.io:443") .with_metadata(tracing_metadata), ) - .with_trace_config(opentelemetry::sdk::trace::config().with_resource( - opentelemetry::sdk::Resource::new(vec![ + .with_trace_config(opentelemetry_sdk::trace::config().with_resource( + opentelemetry_sdk::Resource::new(vec![ opentelemetry::KeyValue::new("service.name", "git-tool"), opentelemetry::KeyValue::new("service.version", version!("v")), opentelemetry::KeyValue::new("host.os", std::env::consts::OS), opentelemetry::KeyValue::new("host.architecture", std::env::consts::ARCH), ]), )) - .install_batch(opentelemetry::runtime::Tokio) + .install_batch(opentelemetry_sdk::runtime::Tokio) .unwrap(); tracing_subscriber::registry() diff --git a/src/update/cmd.rs b/src/update/cmd.rs index d1945c31..02bd1a3e 100644 --- a/src/update/cmd.rs +++ b/src/update/cmd.rs @@ -29,7 +29,7 @@ pub trait Launcher { fn launch(&self, app_path: &Path, state: &UpdateState) -> Result<(), errors::Error> { let trace_context = { let mut context = std::collections::HashMap::new(); - let propagator = opentelemetry::sdk::propagation::TraceContextPropagator::new(); + let propagator = opentelemetry_sdk::propagation::TraceContextPropagator::new(); propagator.inject_context(&tracing::Span::current().context(), &mut context); serde_json::to_string(&context)