diff --git a/libs/blockscout-service-launcher/Cargo.toml b/libs/blockscout-service-launcher/Cargo.toml index cd0bb9209..f7ba6f2d2 100644 --- a/libs/blockscout-service-launcher/Cargo.toml +++ b/libs/blockscout-service-launcher/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "blockscout-service-launcher" -version = "0.13.0" +version = "0.13.1" description = "Allows to launch blazingly fast blockscout rust services" license = "MIT" repository = "https://github.com/blockscout/blockscout-rs" diff --git a/libs/blockscout-service-launcher/src/tracing/request_id_layer.rs b/libs/blockscout-service-launcher/src/tracing/request_id_layer.rs index fc1d0f36c..cf1c4955c 100644 --- a/libs/blockscout-service-launcher/src/tracing/request_id_layer.rs +++ b/libs/blockscout-service-launcher/src/tracing/request_id_layer.rs @@ -1,7 +1,7 @@ use std::{fmt::Debug, str::FromStr}; use tracing::{field::Field, span::Attributes, Id, Subscriber}; use tracing_subscriber::{ - fmt::{format::JsonFields, FormattedFields}, + fmt::{format::JsonFields, FormatFields, FormattedFields}, layer::Context, registry::LookupSpan, Layer, @@ -29,7 +29,18 @@ impl LookupSpan<'lookup>> Layer for RequestIdSto .get_mut::>() .is_none() { - extensions.insert(FormattedFields::::new("{}".to_string())); + let mut fields = FormattedFields::::new(String::new()); + if JsonFields::new() + .format_fields(fields.as_writer(), attrs) + .is_ok() + { + extensions.insert(fields); + } else { + eprintln!( + "[tracing-subscriber] Unable to format the following event, ignoring: {:?}", + attrs + ); + } } let data = extensions.get_mut::>().unwrap(); if let Some(request_id) = request_id {