diff --git a/Cargo.lock b/Cargo.lock index 3ef119ea9..c435124d0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1058,11 +1058,11 @@ dependencies = [ "netstack-lwip", "network-interface", "once_cell", - "opentelemetry 0.22.0", + "opentelemetry", "opentelemetry-jaeger", "opentelemetry-jaeger-propagator", "opentelemetry-otlp", - "opentelemetry_sdk 0.22.1", + "opentelemetry_sdk", "prost", "public-suffix", "quinn", @@ -3460,21 +3460,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "opentelemetry" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900d57987be3f2aeb70d385fff9b27fb74c5723cc9a52d904d4f9c807a0667bf" -dependencies = [ - "futures-core", - "futures-sink", - "js-sys", - "once_cell", - "pin-project-lite", - "thiserror", - "urlencoding", -] - [[package]] name = "opentelemetry" version = "0.23.0" @@ -3499,7 +3484,7 @@ dependencies = [ "bytes", "http 0.2.12", "hyper 0.14.28", - "opentelemetry 0.23.0", + "opentelemetry", "tokio", ] @@ -3515,36 +3500,35 @@ dependencies = [ "headers", "http 0.2.12", "hyper 0.14.28", - "opentelemetry 0.23.0", + "opentelemetry", "opentelemetry-http", - "opentelemetry-semantic-conventions 0.15.0", - "opentelemetry_sdk 0.23.0", + "opentelemetry-semantic-conventions", + "opentelemetry_sdk", "thrift", "tokio", ] [[package]] name = "opentelemetry-jaeger-propagator" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beb4ec62efc537b60aaa89b92624f986f2523d3a609079f3511cc8ee73490826" +checksum = "c190755e0aeec909343896f94670446ac686dd1eaf5e2beb4149a7148cfe1d6c" dependencies = [ - "opentelemetry 0.22.0", + "opentelemetry", ] [[package]] name = "opentelemetry-otlp" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a016b8d9495c639af2145ac22387dcb88e44118e45320d9238fbf4e7889abcb" +checksum = "a94c69209c05319cdf7460c6d4c055ed102be242a0a6245835d7bc42c6ec7f54" dependencies = [ "async-trait", "futures-core", "http 0.2.12", - "opentelemetry 0.22.0", + "opentelemetry", "opentelemetry-proto", - "opentelemetry-semantic-conventions 0.14.0", - "opentelemetry_sdk 0.22.1", + "opentelemetry_sdk", "prost", "thiserror", "tokio", @@ -3553,50 +3537,22 @@ dependencies = [ [[package]] name = "opentelemetry-proto" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a8fddc9b68f5b80dae9d6f510b88e02396f006ad48cac349411fbecc80caae4" +checksum = "984806e6cf27f2b49282e2a05e288f30594f3dbc74eb7a6e99422bc48ed78162" dependencies = [ - "opentelemetry 0.22.0", - "opentelemetry_sdk 0.22.1", + "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-semantic-conventions" version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1869fb4bb9b35c5ba8a1e40c9b128a7b4c010d07091e864a29da19e4fe2ca4d7" -[[package]] -name = "opentelemetry_sdk" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e90c7113be649e31e9a0f8b5ee24ed7a16923b322c3c5ab6367469c049d6b7e" -dependencies = [ - "async-trait", - "crossbeam-channel", - "futures-channel", - "futures-executor", - "futures-util", - "glob", - "once_cell", - "opentelemetry 0.22.0", - "ordered-float 4.2.0", - "percent-encoding", - "rand", - "thiserror", - "tokio", - "tokio-stream", -] - [[package]] name = "opentelemetry_sdk" version = "0.23.0" @@ -3607,9 +3563,10 @@ dependencies = [ "futures-channel", "futures-executor", "futures-util", + "glob", "lazy_static", "once_cell", - "opentelemetry 0.23.0", + "opentelemetry", "ordered-float 4.2.0", "percent-encoding", "rand", @@ -6444,14 +6401,14 @@ dependencies = [ [[package]] name = "tracing-opentelemetry" -version = "0.23.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9be14ba1bbe4ab79e9229f7f89fab8d120b865859f10527f31c033e599d2284" +checksum = "f68803492bf28ab40aeccaecc7021096bd256baf7ca77c3d425d89b35a7be4e4" dependencies = [ "js-sys", "once_cell", - "opentelemetry 0.22.0", - "opentelemetry_sdk 0.22.1", + "opentelemetry", + "opentelemetry_sdk", "smallvec", "tracing", "tracing-core", @@ -6722,12 +6679,6 @@ dependencies = [ "serde", ] -[[package]] -name = "urlencoding" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" - [[package]] name = "utf-8" version = "0.7.6" diff --git a/clash_lib/Cargo.toml b/clash_lib/Cargo.toml index b563bfa21..5a6b3ab18 100644 --- a/clash_lib/Cargo.toml +++ b/clash_lib/Cargo.toml @@ -40,12 +40,12 @@ ip_network_table-deps-treebitmap = "0.5.0" once_cell = "1.18.0" # opentelemetry -opentelemetry = "0.22" -opentelemetry_sdk = { version = "0.22", features = ["rt-tokio"] } -tracing-opentelemetry = "0.23" -opentelemetry-jaeger-propagator = "0.1.0" +opentelemetry = "0.23" +opentelemetry_sdk = { version = "0.23", features = ["rt-tokio"] } +tracing-opentelemetry = "0.24" +opentelemetry-jaeger-propagator = "0.2.0" opentelemetry-jaeger = { version = "0.22", features = ["collector_client", "hyper_collector_client", "rt-tokio"] } -opentelemetry-otlp = { version = "0.15.0", features = ["grpc-tonic"] } +opentelemetry-otlp = { version = "0.16.0", features = ["grpc-tonic"] } crc32fast = "1.4.2" brotli = "6.0.0" diff --git a/clash_lib/src/app/logging.rs b/clash_lib/src/app/logging.rs index f47627b26..05e8ff412 100644 --- a/clash_lib/src/app/logging.rs +++ b/clash_lib/src/app/logging.rs @@ -5,6 +5,7 @@ use opentelemetry::global; use opentelemetry::KeyValue; use opentelemetry_otlp::WithExportConfig; use opentelemetry_sdk::trace; +use opentelemetry_sdk::trace::Sampler; use opentelemetry_sdk::Resource; use serde::Serialize; use tokio::sync::broadcast::Sender; @@ -108,14 +109,18 @@ pub fn setup_logging( let otlp_exporter = opentelemetry_otlp::new_exporter() .tonic() .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)?; + let tracer = opentelemetry_otlp::new_pipeline() + .tracing() + .with_exporter(otlp_exporter) + .with_trace_config( + trace::config() + .with_sampler(Sampler::AlwaysOn) + .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 {