Skip to content
Merged
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
7 changes: 0 additions & 7 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4019,13 +4019,6 @@ dependencies = [
"syn",
]

[[package]]
name = "tools"
version = "0.1.0"
dependencies = [
"tonic-build",
]

[[package]]
name = "tower"
version = "0.5.2"
Expand Down
20 changes: 1 addition & 19 deletions linkerd/app/core/src/http_tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,9 @@ use linkerd_trace_context::{
export::{ExportSpan, SpanKind, SpanLabels},
Span, TraceContext,
};
use std::{str::FromStr, sync::Arc};
use std::sync::Arc;
use tokio::sync::mpsc;

#[derive(Debug, Copy, Clone, Default)]
pub enum CollectorProtocol {
#[default]
OpenTelemetry,
}

impl FromStr for CollectorProtocol {
type Err = ();

fn from_str(s: &str) -> Result<Self, Self::Err> {
if s.eq_ignore_ascii_case("opentelemetry") {
Ok(Self::OpenTelemetry)
} else {
Err(())
}
}
}

pub type SpanSink = mpsc::Sender<ExportSpan>;

pub fn server<S>(
Expand Down
10 changes: 0 additions & 10 deletions linkerd/app/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use linkerd_app_core::{
addr,
config::*,
control::{Config as ControlConfig, ControlAddr},
http_tracing::CollectorProtocol,
proxy::http::{h1, h2},
tls,
transport::{DualListenAddr, Keepalive, ListenAddr, UserTimeout},
Expand Down Expand Up @@ -155,7 +154,6 @@ const ENV_INBOUND_METRICS_AUTHORITY_LABELS: &str =
"LINKERD2_PROXY_INBOUND_METRICS_AUTHORITY_LABELS";

const ENV_TRACE_ATTRIBUTES_PATH: &str = "LINKERD2_PROXY_TRACE_ATTRIBUTES_PATH";
const ENV_TRACE_PROTOCOL: &str = "LINKERD2_PROXY_TRACE_PROTOCOL";
const ENV_TRACE_SERVICE_NAME: &str = "LINKERD2_PROXY_TRACE_SERVICE_NAME";
const ENV_TRACE_EXTRA_ATTRIBUTES: &str = "LINKERD2_PROXY_TRACE_EXTRA_ATTRIBUTES";
// This doesn't have the LINKERD2_ prefix because it is a conventional env var from OpenTelemetry:
Expand Down Expand Up @@ -445,7 +443,6 @@ pub fn parse_config<S: Strings>(strings: &S) -> Result<super::Config, EnvError>
let trace_attributes_file_path = strings.get(ENV_TRACE_ATTRIBUTES_PATH);
let trace_extra_attributes = strings.get(ENV_TRACE_EXTRA_ATTRIBUTES);
let trace_otel_attributes = strings.get(ENV_OTEL_TRACE_ATTRIBUTES);
let trace_protocol = strings.get(ENV_TRACE_PROTOCOL);
let trace_service_name = strings.get(ENV_TRACE_SERVICE_NAME);

let trace_collector_addr = parse_control_addr(strings, ENV_TRACE_COLLECTOR_SVC_BASE);
Expand Down Expand Up @@ -873,12 +870,6 @@ pub fn parse_config<S: Strings>(strings: &S) -> Result<super::Config, EnvError>
}
}

let trace_protocol = trace_protocol
.map(|proto| proto.and_then(|p| p.parse::<CollectorProtocol>().ok()))
.ok()
.flatten()
.unwrap_or_default();

let trace_service_name = trace_service_name.ok().flatten();

trace_collector::Config::Enabled(Box::new(trace_collector::EnabledConfig {
Expand All @@ -893,7 +884,6 @@ pub fn parse_config<S: Strings>(strings: &S) -> Result<super::Config, EnvError>
failfast_timeout,
},
},
kind: trace_protocol,
}))
}
};
Expand Down
40 changes: 15 additions & 25 deletions linkerd/app/src/trace_collector.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
use linkerd_app_core::{
control, dns,
http_tracing::{CollectorProtocol, SpanSink},
identity,
metrics::ControlHttp as HttpMetrics,
opentelemetry,
svc::NewService,
control, dns, http_tracing::SpanSink, identity, metrics::ControlHttp as HttpMetrics,
opentelemetry, svc::NewService,
};
use linkerd_error::Error;
use otel_collector::OtelCollectorAttributes;
Expand All @@ -27,7 +23,6 @@ pub struct EnabledConfig {
pub attributes: HashMap<String, String>,
pub hostname: Option<String>,
pub service_name: Option<String>,
pub kind: CollectorProtocol,
}

pub type Task = Pin<Box<dyn Future<Output = ()> + Send + 'static>>;
Expand All @@ -39,7 +34,6 @@ pub enum TraceCollector {

pub struct EnabledCollector {
pub addr: control::ControlAddr,
pub kind: CollectorProtocol,
pub span_sink: SpanSink,
pub task: Task,
}
Expand All @@ -57,9 +51,7 @@ impl Config {
pub fn metrics_prefix(&self) -> Option<&'static str> {
match self {
Config::Disabled => None,
Config::Enabled(config) => match config.kind {
CollectorProtocol::OpenTelemetry => Some("opentelemetry"),
},
Config::Enabled(_) => Some("opentelemetry"),
}
}

Expand All @@ -83,20 +75,18 @@ impl Config {
.service_name
.unwrap_or_else(|| SERVICE_NAME.to_string());

let collector = match inner.kind {
CollectorProtocol::OpenTelemetry => {
let attributes = OtelCollectorAttributes {
hostname: inner.hostname,
service_name: svc_name,
extra: inner.attributes,
};
otel_collector::create_collector(
addr.clone(),
attributes,
svc,
legacy_otel_metrics,
)
}
let collector = {
let attributes = OtelCollectorAttributes {
hostname: inner.hostname,
service_name: svc_name,
extra: inner.attributes,
};
otel_collector::create_collector(
addr.clone(),
attributes,
svc,
legacy_otel_metrics,
)
};

Ok(TraceCollector::Enabled(Box::new(collector)))
Expand Down
5 changes: 1 addition & 4 deletions linkerd/app/src/trace_collector/otel_collector.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use super::EnabledCollector;
use linkerd_app_core::{
control::ControlAddr, http_tracing::CollectorProtocol, proxy::http::Body, Error,
};
use linkerd_app_core::{control::ControlAddr, proxy::http::Body, Error};
use linkerd_opentelemetry::{
self as opentelemetry, metrics,
proto::{
Expand Down Expand Up @@ -82,7 +80,6 @@ where
addr,
task,
span_sink,
kind: CollectorProtocol::OpenTelemetry,
}
}

Expand Down
Loading