Skip to content

Commit 940e749

Browse files
committed
chore(tracing): Remove OpenCensus remnants
There were a few abstractions over the trace backend (enums, etc.) that can be removed now that OpenCensus has been removed in #4216. Signed-off-by: Scott Fleener <scott@buoyant.io>
1 parent 31e164c commit 940e749

File tree

5 files changed

+17
-65
lines changed

5 files changed

+17
-65
lines changed

Cargo.lock

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4019,13 +4019,6 @@ dependencies = [
40194019
"syn",
40204020
]
40214021

4022-
[[package]]
4023-
name = "tools"
4024-
version = "0.1.0"
4025-
dependencies = [
4026-
"tonic-build",
4027-
]
4028-
40294022
[[package]]
40304023
name = "tower"
40314024
version = "0.5.2"

linkerd/app/core/src/http_tracing.rs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,9 @@ use linkerd_trace_context::{
55
export::{ExportSpan, SpanKind, SpanLabels},
66
Span, TraceContext,
77
};
8-
use std::{str::FromStr, sync::Arc};
8+
use std::sync::Arc;
99
use tokio::sync::mpsc;
1010

11-
#[derive(Debug, Copy, Clone, Default)]
12-
pub enum CollectorProtocol {
13-
#[default]
14-
OpenTelemetry,
15-
}
16-
17-
impl FromStr for CollectorProtocol {
18-
type Err = ();
19-
20-
fn from_str(s: &str) -> Result<Self, Self::Err> {
21-
if s.eq_ignore_ascii_case("opentelemetry") {
22-
Ok(Self::OpenTelemetry)
23-
} else {
24-
Err(())
25-
}
26-
}
27-
}
28-
2911
pub type SpanSink = mpsc::Sender<ExportSpan>;
3012

3113
pub fn server<S>(

linkerd/app/src/env.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use linkerd_app_core::{
33
addr,
44
config::*,
55
control::{Config as ControlConfig, ControlAddr},
6-
http_tracing::CollectorProtocol,
76
proxy::http::{h1, h2},
87
tls,
98
transport::{DualListenAddr, Keepalive, ListenAddr, UserTimeout},
@@ -155,7 +154,6 @@ const ENV_INBOUND_METRICS_AUTHORITY_LABELS: &str =
155154
"LINKERD2_PROXY_INBOUND_METRICS_AUTHORITY_LABELS";
156155

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

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

876-
let trace_protocol = trace_protocol
877-
.map(|proto| proto.and_then(|p| p.parse::<CollectorProtocol>().ok()))
878-
.ok()
879-
.flatten()
880-
.unwrap_or_default();
881-
882873
let trace_service_name = trace_service_name.ok().flatten();
883874

884875
trace_collector::Config::Enabled(Box::new(trace_collector::EnabledConfig {
@@ -893,7 +884,6 @@ pub fn parse_config<S: Strings>(strings: &S) -> Result<super::Config, EnvError>
893884
failfast_timeout,
894885
},
895886
},
896-
kind: trace_protocol,
897887
}))
898888
}
899889
};

linkerd/app/src/trace_collector.rs

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
use linkerd_app_core::{
2-
control, dns,
3-
http_tracing::{CollectorProtocol, SpanSink},
4-
identity,
5-
metrics::ControlHttp as HttpMetrics,
6-
opentelemetry,
7-
svc::NewService,
2+
control, dns, http_tracing::SpanSink, identity, metrics::ControlHttp as HttpMetrics,
3+
opentelemetry, svc::NewService,
84
};
95
use linkerd_error::Error;
106
use otel_collector::OtelCollectorAttributes;
@@ -27,7 +23,6 @@ pub struct EnabledConfig {
2723
pub attributes: HashMap<String, String>,
2824
pub hostname: Option<String>,
2925
pub service_name: Option<String>,
30-
pub kind: CollectorProtocol,
3126
}
3227

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

4035
pub struct EnabledCollector {
4136
pub addr: control::ControlAddr,
42-
pub kind: CollectorProtocol,
4337
pub span_sink: SpanSink,
4438
pub task: Task,
4539
}
@@ -57,9 +51,7 @@ impl Config {
5751
pub fn metrics_prefix(&self) -> Option<&'static str> {
5852
match self {
5953
Config::Disabled => None,
60-
Config::Enabled(config) => match config.kind {
61-
CollectorProtocol::OpenTelemetry => Some("opentelemetry"),
62-
},
54+
Config::Enabled(_) => Some("opentelemetry"),
6355
}
6456
}
6557

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

86-
let collector = match inner.kind {
87-
CollectorProtocol::OpenTelemetry => {
88-
let attributes = OtelCollectorAttributes {
89-
hostname: inner.hostname,
90-
service_name: svc_name,
91-
extra: inner.attributes,
92-
};
93-
otel_collector::create_collector(
94-
addr.clone(),
95-
attributes,
96-
svc,
97-
legacy_otel_metrics,
98-
)
99-
}
78+
let collector = {
79+
let attributes = OtelCollectorAttributes {
80+
hostname: inner.hostname,
81+
service_name: svc_name,
82+
extra: inner.attributes,
83+
};
84+
otel_collector::create_collector(
85+
addr.clone(),
86+
attributes,
87+
svc,
88+
legacy_otel_metrics,
89+
)
10090
};
10191

10292
Ok(TraceCollector::Enabled(Box::new(collector)))

linkerd/app/src/trace_collector/otel_collector.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
use super::EnabledCollector;
2-
use linkerd_app_core::{
3-
control::ControlAddr, http_tracing::CollectorProtocol, proxy::http::Body, Error,
4-
};
2+
use linkerd_app_core::{control::ControlAddr, proxy::http::Body, Error};
53
use linkerd_opentelemetry::{
64
self as opentelemetry, metrics,
75
proto::{
@@ -82,7 +80,6 @@ where
8280
addr,
8381
task,
8482
span_sink,
85-
kind: CollectorProtocol::OpenTelemetry,
8683
}
8784
}
8885

0 commit comments

Comments
 (0)