Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update OTEL deps #1123

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 32 additions & 17 deletions Cargo.lock

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

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ 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-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
Loading