From f9c81facb2012bf25b6938314f0619a69b49a61f Mon Sep 17 00:00:00 2001 From: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com> Date: Mon, 2 Sep 2024 11:21:47 +0200 Subject: [PATCH] Remove once_cell dependency --- examples/custom-root-span/Cargo.toml | 1 - examples/custom-root-span/src/main.rs | 6 +++--- examples/opentelemetry/Cargo.toml | 1 - examples/opentelemetry/src/main.rs | 6 +++--- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/examples/custom-root-span/Cargo.toml b/examples/custom-root-span/Cargo.toml index f2f39eaf1..b04130afc 100644 --- a/examples/custom-root-span/Cargo.toml +++ b/examples/custom-root-span/Cargo.toml @@ -8,7 +8,6 @@ edition = "2021" [dependencies] actix-web = "4" -once_cell = "1.19" opentelemetry = "0.24" opentelemetry-otlp = "0.17" opentelemetry_sdk = { version = "0.24", features = ["rt-tokio-current-thread"] } diff --git a/examples/custom-root-span/src/main.rs b/examples/custom-root-span/src/main.rs index f69c7900c..17179accf 100644 --- a/examples/custom-root-span/src/main.rs +++ b/examples/custom-root-span/src/main.rs @@ -1,7 +1,6 @@ use actix_web::body::MessageBody; use actix_web::dev::{ServiceRequest, ServiceResponse}; use actix_web::{web, App, Error, HttpServer}; -use once_cell::sync::Lazy; use opentelemetry::trace::TracerProvider; use opentelemetry::{global, KeyValue}; use opentelemetry_otlp::WithExportConfig; @@ -10,6 +9,7 @@ use opentelemetry_sdk::{ }; use opentelemetry_semantic_conventions::resource; use std::io; +use std::sync::LazyLock; use tracing::Span; use tracing_actix_web::{DefaultRootSpanBuilder, RootSpan, RootSpanBuilder, TracingLogger}; use tracing_bunyan_formatter::{BunyanFormattingLayer, JsonStorageLayer}; @@ -74,8 +74,8 @@ async fn main() -> io::Result<()> { const APP_NAME: &str = "tracing-actix-web-demo"; -static RESOURCE: Lazy = - Lazy::new(|| Resource::new(vec![KeyValue::new(resource::SERVICE_NAME, APP_NAME)])); +static RESOURCE: LazyLock = + LazyLock::new(|| Resource::new(vec![KeyValue::new(resource::SERVICE_NAME, APP_NAME)])); /// Init a `tracing` subscriber that prints spans to stdout as well as /// ships them to Jaeger. diff --git a/examples/opentelemetry/Cargo.toml b/examples/opentelemetry/Cargo.toml index 26cfa245a..d4c66d18e 100644 --- a/examples/opentelemetry/Cargo.toml +++ b/examples/opentelemetry/Cargo.toml @@ -8,7 +8,6 @@ license = "MIT/Apache-2.0" [dependencies] actix-web = "4" -once_cell = "1.19" opentelemetry = "0.24" opentelemetry_sdk = { version = "0.24", features = ["rt-tokio-current-thread"] } opentelemetry-otlp = "0.17" diff --git a/examples/opentelemetry/src/main.rs b/examples/opentelemetry/src/main.rs index 73ff294e0..fab4dce84 100644 --- a/examples/opentelemetry/src/main.rs +++ b/examples/opentelemetry/src/main.rs @@ -1,5 +1,4 @@ use actix_web::{web, App, HttpServer}; -use once_cell::sync::Lazy; use opentelemetry::trace::TracerProvider; use opentelemetry::{global, KeyValue}; use opentelemetry_otlp::WithExportConfig; @@ -8,14 +7,15 @@ use opentelemetry_sdk::{ }; use opentelemetry_semantic_conventions::resource; use std::io; +use std::sync::LazyLock; use tracing_actix_web::TracingLogger; use tracing_bunyan_formatter::{BunyanFormattingLayer, JsonStorageLayer}; use tracing_subscriber::{layer::SubscriberExt, EnvFilter, Registry}; const APP_NAME: &str = "tracing-actix-web-demo"; -static RESOURCE: Lazy = - Lazy::new(|| Resource::new(vec![KeyValue::new(resource::SERVICE_NAME, APP_NAME)])); +static RESOURCE: LazyLock = + LazyLock::new(|| Resource::new(vec![KeyValue::new(resource::SERVICE_NAME, APP_NAME)])); async fn hello() -> &'static str { "Hello world!"