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
This commit is contained in:
1 parent
97c81f899c
commit
9c770b0576
1 file changed
+11
-5
+11
-5
@@ -201,11 +201,14 @@ pub fn spawn_exporters(state: AppState) -> Vec<JoinHandle<()>> {
|
||||
///
|
||||
/// 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()),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user