Skip to content

Commit

Permalink
Bump opentelemetry_sdk from 0.21.2 to 0.22.1 (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] authored Mar 6, 2024
1 parent 3979614 commit 749e993
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 29 deletions.
102 changes: 84 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions clash_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
24 changes: 17 additions & 7 deletions clash_lib/src/app/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 749e993

Please sign in to comment.