From 9c770b05768675186eb7a07e90ffd7ecfabca4b0 Mon Sep 17 00:00:00 2001 From: ari Date: Tue, 20 Oct 2026 16:14:14 -0400 Subject: [PATCH] H: mark the peer.request span as an OTel client span otel.kind = client is set on the span and asserted in the span test --- src/telemetry/mod.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/telemetry/mod.rs b/src/telemetry/mod.rs index 2fb0aa3..ce6351b 100644 --- a/src/telemetry/mod.rs +++ b/src/telemetry/mod.rs @@ -201,11 +201,14 @@ pub fn spawn_exporters(state: AppState) -> Vec> { /// /// The peer name is the only attribute: peer URLs may embed hostnames the /// operator treats as sensitive, and a bounded name keeps cardinality flat. -/// Callers enter this span (or instrument the request future with it) before -/// building [`crate::peers::ProxyOpts`], so the injected `traceparent` names -/// this span as the peer request's parent on the other side. +/// The span kind is `client` so a trace backend draws the fleet one way; +/// `otel.kind` is consumed by the tracing layer and never exported as an +/// attribute. Callers enter this span (or instrument the request future with +/// it) before building [`crate::peers::ProxyOpts`], so the injected +/// `traceparent` names this span as the peer request's parent on the other +/// side. pub fn peer_request_span(peer: &str) -> tracing::Span { - tracing::info_span!("peer.request", "peer.name" = peer) + tracing::info_span!("peer.request", "peer.name" = peer, "otel.kind" = "client") } /// W3C `traceparent` for the currently active span, or `None` when there is no @@ -593,7 +596,10 @@ mod tests { assert_eq!(spans[0].0, "peer.request"); assert_eq!( spans[0].1, - vec![("peer.name".to_owned(), "beta".to_owned())] + vec![ + ("peer.name".to_owned(), "beta".to_owned()), + ("otel.kind".to_owned(), "client".to_owned()), + ] ); }