Skip to content

Commit 1ad286f

Browse files
authored
Set tracing spans on policy client (#1241)
This change ensures that policy watches include tracing spans.
1 parent 3bf94d5 commit 1ad286f

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

linkerd/app/inbound/src/policy/store.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use std::{
99
sync::Arc,
1010
};
1111
use tokio::sync::watch;
12+
use tracing::{info_span, Instrument};
1213

1314
#[derive(Clone, Debug)]
1415
pub struct Store {
@@ -93,6 +94,7 @@ impl Store {
9394
discover
9495
.clone()
9596
.spawn_watch(port)
97+
.instrument(info_span!("watch", %port))
9698
.map_ok(move |rsp| (port, rsp.into_inner()))
9799
});
98100

linkerd/app/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,11 @@ impl Config {
210210
.instrument(info_span!("outbound")),
211211
);
212212

213-
let inbound_policies = inbound.build_policies(dns, control_metrics).await;
213+
let inbound_policies = inbound
214+
.build_policies(dns, control_metrics)
215+
.instrument(info_span!("policy"))
216+
.await;
217+
214218
tokio::spawn(
215219
inbound
216220
.serve(

linkerd/tonic-watch/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use linkerd_error::Recover;
66
use linkerd_stack::{Service, ServiceExt};
77
use std::task::{Context, Poll};
88
use tokio::sync::watch;
9-
use tracing::{debug, trace};
9+
use tracing::{debug, trace, Instrument};
1010

1111
/// A service that streams updates from an inner service into a `tokio::sync::watch::Receiver` on a
1212
/// background task.
@@ -55,7 +55,7 @@ where
5555
// Spawn a background task to keep the profile watch up-to-date until all copies of `rx`
5656
// have dropped.
5757
let (tx, rx) = watch::channel(init);
58-
tokio::spawn(self.publish_updates(target, tx, inner));
58+
tokio::spawn(self.publish_updates(target, tx, inner).in_current_span());
5959
rx
6060
}))
6161
}

0 commit comments

Comments
 (0)