From e62100000a34ff7621b83d0d25894b1c1cb66c37 Mon Sep 17 00:00:00 2001 From: NickAc <32451103+NickAcPT@users.noreply.github.com> Date: Wed, 31 Jul 2024 12:29:08 +0100 Subject: [PATCH] Bump OpenTelemetry and other crates --- nmsr-aas/Cargo.toml | 18 +++++++++--------- nmsr-aas/src/main.rs | 16 ++++++++++------ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/nmsr-aas/Cargo.toml b/nmsr-aas/Cargo.toml index d544cb8..b81a168 100644 --- a/nmsr-aas/Cargo.toml +++ b/nmsr-aas/Cargo.toml @@ -44,7 +44,7 @@ serde_json = { workspace = true } base64 = "0.22" # Hyper - HTTP client -hyper = { version = "1.2.0", features = ["client"] } +hyper = { version = "1.4", features = ["client"] } hyper-util = { version = "0.1", features = ["client", "client-legacy", "http1", "http2", "server-auto", "tokio"] } hyper-tls = "0.6" url = "2.5" @@ -62,12 +62,12 @@ tracing = { workspace = true } tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] } # OpenTelemetry - Tracing framework -opentelemetry = { version = "0.22", features = [] } -opentelemetry_sdk = { version = "0.22", features = ["rt-tokio"] } -opentelemetry-otlp = { version = "0.15", default-features = true } +opentelemetry = { version = "0.24", features = [] } +opentelemetry_sdk = { version = "0.24", features = ["rt-tokio"] } +opentelemetry-otlp = { version = "0.17", default-features = true } # Tracing OpenTelemetry - Tracing subscriber for OpenTelemetry -tracing-opentelemetry = "0.23" +tracing-opentelemetry = "0.25" # Strum - Enum helper library strum = { workspace = true } @@ -83,17 +83,17 @@ thiserror = { workspace = true } derive_more = { workspace = true } # Tower - Service framework -tower = { version = "0.4", features = ["limit"] } +tower = { version = "0.4", features = ["limit", "timeout"] } tower-http = { version = "0.5", features = ["full"] } -http = "1.0" +http = "1.1" # symlink - Symbolic link library (because Rust's standard library doesn't handle that properly for us) symlink = "0.1" humantime-serde = "1.1" -serde_with = "3.3" +serde_with = "3.9" deadpool = { workspace = true } image = { workspace = true, default-features = false } -mtpng = "0.3" +mtpng = "0.4" chrono = "0.4" tokio-stream = { version = "0.1", features = ["fs"] } diff --git a/nmsr-aas/src/main.rs b/nmsr-aas/src/main.rs index 89b005a..681b672 100644 --- a/nmsr-aas/src/main.rs +++ b/nmsr-aas/src/main.rs @@ -28,10 +28,13 @@ use anyhow::Context; use axum::routing::post; use axum::{routing::get, Router}; use http::HeaderName; +use opentelemetry::trace::TracerProvider; use opentelemetry::StringValue; use opentelemetry::{global, KeyValue}; use opentelemetry_otlp::{new_exporter, WithExportConfig}; -use opentelemetry_sdk::{propagation::TraceContextPropagator, trace, Resource}; +use opentelemetry_sdk::{ + propagation::TraceContextPropagator, trace::Config as TracingConfig, Resource, +}; use std::{net::SocketAddr, path::PathBuf}; use tokio::{main, signal}; use tower_http::request_id::MakeRequestUuid; @@ -169,13 +172,14 @@ fn setup_tracing(tracing: Option<&TracingConfiguration>) -> anyhow::Result<()> { let tracer = opentelemetry_otlp::new_pipeline() .tracing() .with_exporter(new_exporter().tonic().with_endpoint(&tracing.endpoint)) - .with_trace_config( - trace::config().with_resource(Resource::new(vec![KeyValue::new( + .with_trace_config(TracingConfig::default().with_resource(Resource::new(vec![ + KeyValue::new( "service.name", Into::::into(tracing.service_name.clone()), - )])), - ) - .install_batch(opentelemetry_sdk::runtime::Tokio)?; + ), + ]))) + .install_batch(opentelemetry_sdk::runtime::Tokio)? + .tracer("nmsr-aas"); let otel_layer = tracing_subscriber::Layer::with_filter( tracing_opentelemetry::layer().with_tracer(tracer),