diff --git a/hello-tracing-common/src/otel/grpc.rs b/hello-tracing-common/src/otel/grpc.rs index 778f381..c4c2ce2 100644 --- a/hello-tracing-common/src/otel/grpc.rs +++ b/hello-tracing-common/src/otel/grpc.rs @@ -3,7 +3,7 @@ use tonic::{ metadata::{MetadataKey, MetadataMap, MetadataValue}, Request, Status, }; -use tracing::{error, Span}; +use tracing::{warn, Span}; use tracing_opentelemetry::OpenTelemetrySpanExt; /// Trace context propagation: send the trace context by injecting it into the metadata of the given @@ -22,23 +22,15 @@ struct MetadataInjector<'a>(&'a mut MetadataMap); impl Injector for MetadataInjector<'_> { fn set(&mut self, key: &str, value: String) { match MetadataKey::from_bytes(key.as_bytes()) { - Ok(name) => match MetadataValue::try_from(&value) { + Ok(key) => match MetadataValue::try_from(&value) { Ok(value) => { - self.0.insert(name, value); + self.0.insert(key, value); } - Err(error) => error!( - value, - error = format!("{error:#}"), - "parse value as metadata value" - ), + Err(error) => warn!(value, error = format!("{error:#}"), "parse metadata value"), }, - Err(error) => error!( - key, - error = format!("{error:#}"), - "parse key as metadata value" - ), + Err(error) => warn!(key, error = format!("{error:#}"), "parse metadata key"), } } }