From 749e993c95ffeb09f273f06ccaea3ef940886f2b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Mar 2024 18:20:38 +1100 Subject: [PATCH] Bump opentelemetry_sdk from 0.21.2 to 0.22.1 (#287) --- Cargo.lock | 102 ++++++++++++++++++++++++++++------- clash_lib/Cargo.toml | 10 ++-- clash_lib/src/app/logging.rs | 24 ++++++--- 3 files changed, 107 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d1e68dd72..db4e11966 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1078,6 +1078,8 @@ dependencies = [ "once_cell", "opentelemetry", "opentelemetry-jaeger", + "opentelemetry-jaeger-propagator", + "opentelemetry-otlp", "opentelemetry_sdk", "prost", "public-suffix", @@ -1174,7 +1176,7 @@ dependencies = [ "futures-core", "prost", "prost-types", - "tonic", + "tonic 0.10.2", "tracing-core", ] @@ -1196,7 +1198,7 @@ dependencies = [ "thread_local", "tokio", "tokio-stream", - "tonic", + "tonic 0.10.2", "tracing", "tracing-core", "tracing-subscriber", @@ -3488,13 +3490,12 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "opentelemetry" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e32339a5dc40459130b3bd269e9892439f55b33e772d2a9d402a789baaf4e8a" +checksum = "900d57987be3f2aeb70d385fff9b27fb74c5723cc9a52d904d4f9c807a0667bf" dependencies = [ "futures-core", "futures-sink", - "indexmap 2.2.1", "js-sys", "once_cell", "pin-project-lite", @@ -3504,9 +3505,9 @@ dependencies = [ [[package]] name = "opentelemetry-http" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f51189ce8be654f9b5f7e70e49967ed894e84a06fc35c6c042e64ac1fc5399e" +checksum = "7cbfa5308166ca861434f0b0913569579b8e587430a3d6bcd7fd671921ec145a" dependencies = [ "async-trait", "bytes", @@ -3518,9 +3519,9 @@ dependencies = [ [[package]] name = "opentelemetry-jaeger" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e617c66fd588e40e0dbbd66932fdc87393095b125d4459b1a3a10feb1712f8a1" +checksum = "fb7f5ef13427696ae8382c6f3bb7dcdadb5994223d6b983c7c50a46df7d19277" dependencies = [ "async-trait", "futures-core", @@ -3537,19 +3538,57 @@ dependencies = [ ] [[package]] -name = "opentelemetry-semantic-conventions" -version = "0.13.0" +name = "opentelemetry-jaeger-propagator" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5774f1ef1f982ef2a447f6ee04ec383981a3ab99c8e77a1a7b30182e65bbc84" +checksum = "beb4ec62efc537b60aaa89b92624f986f2523d3a609079f3511cc8ee73490826" dependencies = [ "opentelemetry", ] +[[package]] +name = "opentelemetry-otlp" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a016b8d9495c639af2145ac22387dcb88e44118e45320d9238fbf4e7889abcb" +dependencies = [ + "async-trait", + "futures-core", + "http 0.2.11", + "opentelemetry", + "opentelemetry-http", + "opentelemetry-proto", + "opentelemetry-semantic-conventions", + "opentelemetry_sdk", + "prost", + "thiserror", + "tokio", + "tonic 0.11.0", +] + +[[package]] +name = "opentelemetry-proto" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a8fddc9b68f5b80dae9d6f510b88e02396f006ad48cac349411fbecc80caae4" +dependencies = [ + "opentelemetry", + "opentelemetry_sdk", + "prost", + "tonic 0.11.0", +] + +[[package]] +name = "opentelemetry-semantic-conventions" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9ab5bd6c42fb9349dcf28af2ba9a0667f697f9bdcca045d39f2cec5543e2910" + [[package]] name = "opentelemetry_sdk" -version = "0.21.2" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f16aec8a98a457a52664d69e0091bac3a0abd18ead9b641cb00202ba4e0efe4" +checksum = "9e90c7113be649e31e9a0f8b5ee24ed7a16923b322c3c5ab6367469c049d6b7e" dependencies = [ "async-trait", "crossbeam-channel", @@ -5456,6 +5495,33 @@ dependencies = [ "tracing", ] +[[package]] +name = "tonic" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" +dependencies = [ + "async-stream", + "async-trait", + "axum 0.6.20", + "base64 0.21.7", + "bytes", + "h2 0.3.24", + "http 0.2.11", + "http-body 0.4.6", + "hyper 0.14.28", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost", + "tokio", + "tokio-stream", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + [[package]] name = "tor-async-utils" version = "0.1.5" @@ -6320,9 +6386,9 @@ dependencies = [ [[package]] name = "tracing-opentelemetry" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c67ac25c5407e7b961fafc6f7e9aa5958fd297aada2d20fa2ae1737357e55596" +checksum = "a9be14ba1bbe4ab79e9229f7f89fab8d120b865859f10527f31c033e599d2284" dependencies = [ "js-sys", "once_cell", @@ -6749,9 +6815,9 @@ dependencies = [ [[package]] name = "web-time" -version = "0.2.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa30049b1c872b72c89866d458eae9f20380ab280ffd1b1e18df2d3e2d98cfe0" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/clash_lib/Cargo.toml b/clash_lib/Cargo.toml index 7cb995d70..fc8951749 100644 --- a/clash_lib/Cargo.toml +++ b/clash_lib/Cargo.toml @@ -42,10 +42,12 @@ ip_network_table-deps-treebitmap = "0.5.0" once_cell = "1.18.0" # opentelemetry -opentelemetry = "0.21" -opentelemetry_sdk = "0.21" -tracing-opentelemetry = "0.22" -opentelemetry-jaeger = { version = "0.20", features = ["collector_client", "hyper_collector_client", "rt-tokio"] } +opentelemetry = "0.22" +opentelemetry_sdk = { version = "0.22", features = ["rt-tokio"] } +tracing-opentelemetry = "0.23" +opentelemetry-jaeger-propagator = "0.1.0" +opentelemetry-jaeger = { version = "0.21", features = ["collector_client", "hyper_collector_client", "rt-tokio"] } +opentelemetry-otlp = { version = "0.15.0", features = ["http-proto"] } crc32fast = "1.4.0" brotli = "3.4.0" diff --git a/clash_lib/src/app/logging.rs b/clash_lib/src/app/logging.rs index ff6338ed8..752490c95 100644 --- a/clash_lib/src/app/logging.rs +++ b/clash_lib/src/app/logging.rs @@ -2,6 +2,10 @@ use std::io::IsTerminal; use crate::def::LogLevel; use opentelemetry::global; +use opentelemetry::KeyValue; +use opentelemetry_otlp::WithExportConfig; +use opentelemetry_sdk::trace; +use opentelemetry_sdk::Resource; use serde::Serialize; use tokio::sync::broadcast::Sender; @@ -99,13 +103,19 @@ pub fn setup_logging( .from_env_lossy(); let jaeger = if let Ok(jager_endpoint) = std::env::var("JAGER_ENDPOINT") { - global::set_text_map_propagator(opentelemetry_jaeger::Propagator::new()); - - let tracer = opentelemetry_jaeger::new_collector_pipeline() - .with_service_name("clash-rs") - .with_endpoint(jager_endpoint) - .with_hyper() - .install_batch(opentelemetry_sdk::runtime::Tokio)?; + global::set_text_map_propagator(opentelemetry_jaeger_propagator::Propagator::new()); + + let otlp_exporter = opentelemetry_otlp::new_exporter() + .http() + .with_endpoint(jager_endpoint); + let tracer = + opentelemetry_otlp::new_pipeline() + .tracing() + .with_exporter(otlp_exporter) + .with_trace_config(trace::config().with_resource(Resource::new(vec![ + KeyValue::new("service.name", "clash-rs"), + ]))) + .install_batch(opentelemetry_sdk::runtime::Tokio)?; Some(tracing_opentelemetry::layer().with_tracer(tracer)) } else {