11use 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} ;
95use linkerd_error:: Error ;
106use 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
3328pub type Task = Pin < Box < dyn Future < Output = ( ) > + Send + ' static > > ;
@@ -39,7 +34,6 @@ pub enum TraceCollector {
3934
4035pub 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) ) )
0 commit comments