Skip to content

Commit

Permalink
chore: update OTEL deps
Browse files Browse the repository at this point in the history
  • Loading branch information
helio-frota authored and ctron committed Jan 13, 2025
1 parent 4a7ae84 commit 26e33cb
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 45 deletions.
37 changes: 19 additions & 18 deletions Cargo.lock

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

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ actix-tls = "3"
actix-web = "4.3.1"
actix-web-extras = "0.1"
actix-web-httpauth = "0.8"
actix-web-opentelemetry = "0.19"
actix-web-prom = "0.8.0"
actix-web-opentelemetry = "0.20"
actix-web-prom = "0.9.0"
actix-web-static-files = "4.0.1"
anyhow = "1.0.72"
async-compression = "0.4.13"
Expand Down Expand Up @@ -88,9 +88,9 @@ nu-ansi-term = "0.50"
once_cell = "1.19.0"
openid = "0.15"
openssl = "0.10"
opentelemetry = "0.24"
opentelemetry-otlp = "0.17" # Note: This uses OTEL 0.24 https://crates.io/crates/opentelemetry-otlp/0.17.0/dependencies
opentelemetry_sdk = "0.24"
opentelemetry = "0.27"
opentelemetry-otlp = "0.27"
opentelemetry_sdk = "0.27"
osv = { version = "0.2.0", default-features = false }
packageurl = "0.3.0"
parking_lot = "0.12"
Expand Down Expand Up @@ -132,12 +132,12 @@ test-log = "0.2.16"
thiserror = "1.0.58"
time = "0.3"
tokio = "1.30.0"
tokio-stream = "0.1.15"
tokio-stream = "0.1.17"
tokio-util = "0.7"
tracing = "0.1"
tracing-bunyan-formatter = "0.3.7"
tracing-opentelemetry = "0.25" # Note: This uses OTEL 0.24 https://crates.io/crates/tracing-opentelemetry/0.25.0/dependencies
tracing-subscriber = { version = "0.3.18", default-features = false }
tracing-bunyan-formatter = "0.3.10"
tracing-opentelemetry = "0.28"
tracing-subscriber = { version = "0.3.19", default-features = false }
url = "2.5.0"
urlencoding = "2"
utoipa = "5.1.3"
Expand Down
35 changes: 17 additions & 18 deletions common/infrastructure/src/tracing.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use core::fmt;
use opentelemetry::{propagation::Injector, trace::TracerProvider, Context, KeyValue};
use opentelemetry_sdk::Resource;
use opentelemetry_otlp::SpanExporter;
use opentelemetry_sdk::{trace as sdktrace, Resource};
use reqwest::RequestBuilder;
use std::sync::Once;
use tracing_subscriber::{
Expand Down Expand Up @@ -107,28 +108,26 @@ pub fn init_tracing(name: &str, tracing: Tracing) {
}

fn init_otlp(name: &str) {
use tracing_subscriber::prelude::*;

opentelemetry::global::set_text_map_propagator(
opentelemetry_sdk::propagation::TraceContextPropagator::new(),
);

#[allow(clippy::expect_used)]
let provider = opentelemetry_otlp::new_pipeline()
.tracing()
.with_trace_config(
opentelemetry_sdk::trace::Config::default()
.with_resource(Resource::new(vec![KeyValue::new(
"service.name",
name.to_string(),
)]))
.with_sampler(opentelemetry_sdk::trace::Sampler::ParentBased(Box::new(
sampler(),
))),
)
.with_exporter(opentelemetry_otlp::new_exporter().tonic())
.install_batch(opentelemetry_sdk::runtime::Tokio)
.expect("unable to setup tracing pipeline");
let exporter = SpanExporter::builder()
.with_tonic()
.build()
.expect("Unable to build OTEL exporter");

let provider = sdktrace::TracerProvider::builder()
.with_resource(Resource::new(vec![KeyValue::new(
"service.name",
name.to_string(),
)]))
.with_batch_exporter(exporter, opentelemetry_sdk::runtime::Tokio)
.with_sampler(opentelemetry_sdk::trace::Sampler::ParentBased(Box::new(
sampler(),
)))
.build();

println!("Using Jaeger tracing.");
println!("{:#?}", provider);
Expand Down

0 comments on commit 26e33cb

Please sign in to comment.