Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3018,6 +3018,8 @@ dependencies = [
"percent-encoding",
"rand 0.9.2",
"thiserror",
"tokio",
"tokio-stream",
]

[[package]]
Expand Down
20 changes: 6 additions & 14 deletions linkerd/app/core/src/http_tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,17 @@ use tokio::sync::mpsc;
pub type SpanSink = mpsc::Sender<ExportSpan>;

pub fn server<S>(
sink: Option<SpanSink>,
_sink: Option<SpanSink>,
labels: impl Into<SpanLabels>,
) -> impl layer::Layer<S, Service = TraceContext<Option<SpanConverter>, S>> + Clone {
TraceContext::layer(sink.map(move |sink| SpanConverter {
kind: SpanKind::Server,
sink,
labels: labels.into(),
}))
) -> impl layer::Layer<S, Service = TraceContext<S>> + Clone {
TraceContext::layer(SpanKind::Server, labels.into())
}

pub fn client<S>(
sink: Option<SpanSink>,
_sink: Option<SpanSink>,
labels: impl Into<SpanLabels>,
) -> impl layer::Layer<S, Service = TraceContext<Option<SpanConverter>, S>> + Clone {
TraceContext::layer(sink.map(move |sink| SpanConverter {
kind: SpanKind::Client,
sink,
labels: labels.into(),
}))
) -> impl layer::Layer<S, Service = TraceContext<S>> + Clone {
TraceContext::layer(SpanKind::Client, labels.into())
}

#[derive(Clone)]
Expand Down
5 changes: 0 additions & 5 deletions linkerd/app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,6 @@ impl App {
admin,
drain,
identity,
trace_collector: collector,
start_proxy,
tap,
..
Expand Down Expand Up @@ -464,10 +463,6 @@ impl App {
tokio::spawn(serve.instrument(info_span!("tap").or_current()));
}

if let trace_collector::TraceCollector::Enabled(collector) = collector {
tokio::spawn(collector.task.instrument(info_span!("tracing")));
}

// we don't care if the admin shutdown channel is
// dropped or actually triggered.
let _ = admin_shutdown_rx.await;
Expand Down
1 change: 0 additions & 1 deletion linkerd/app/src/trace_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ pub enum TraceCollector {
pub struct EnabledCollector {
pub addr: control::ControlAddr,
pub span_sink: SpanSink,
pub task: Task,
}

impl TraceCollector {
Expand Down
16 changes: 3 additions & 13 deletions linkerd/app/src/trace_collector/otel_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ use std::{
time::{SystemTime, UNIX_EPOCH},
};
use tokio::sync::mpsc;
use tokio_stream::wrappers::ReceiverStream;
use tonic::{body::Body as TonicBody, client::GrpcService};
use tracing::Instrument;

pub(super) struct OtelCollectorAttributes {
pub hostname: Option<String>,
Expand All @@ -28,8 +26,7 @@ where
S::ResponseBody: Body<Data = tonic::codegen::Bytes> + Send + 'static,
<S::ResponseBody as Body>::Error: Into<Error> + Send,
{
let (span_sink, spans_rx) = mpsc::channel(crate::trace_collector::SPAN_BUFFER_CAPACITY);
let spans_rx = ReceiverStream::new(spans_rx);
let (span_sink, _) = mpsc::channel(crate::trace_collector::SPAN_BUFFER_CAPACITY);

let resource = sdk::Resource::builder()
.with_attribute(KeyValue::new(
Expand All @@ -56,14 +53,7 @@ where
.build();

let addr = addr.clone();
let task = Box::pin(
opentelemetry::export_spans(svc, spans_rx, resource, legacy_metrics)
.instrument(tracing::debug_span!("opentelemetry", peer.addr = %addr).or_current()),
);
opentelemetry::install_opentelemetry_providers(svc, resource, legacy_metrics);

EnabledCollector {
addr,
task,
span_sink,
}
EnabledCollector { addr, span_sink }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addr seems to no longer need to be cloned

}
Loading
Loading