Skip to content

Commit 7a5fb85

Browse files
fully remove authority and target_addr in labels
1 parent cb16532 commit 7a5fb85

File tree

8 files changed

+8
-53
lines changed

8 files changed

+8
-53
lines changed

linkerd/app/admin/src/stack.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,6 @@ impl Param<metrics::EndpointLabels> for Permitted {
269269
fn param(&self) -> metrics::EndpointLabels {
270270
metrics::InboundEndpointLabels {
271271
tls: self.http.tcp.tls.clone(),
272-
authority: None,
273-
target_addr: self.http.tcp.addr.into(),
274272
policy: self.permit.labels.clone(),
275273
}
276274
.into()

linkerd/app/core/src/metrics.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ pub use linkerd_metrics::*;
1919
use linkerd_proxy_server_policy as policy;
2020
use std::{
2121
fmt::{self, Write},
22-
net::SocketAddr,
2322
sync::Arc,
2423
time::Duration,
2524
};
@@ -66,8 +65,6 @@ pub enum EndpointLabels {
6665
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
6766
pub struct InboundEndpointLabels {
6867
pub tls: tls::ConditionalServerTls,
69-
pub authority: Option<http::uri::Authority>,
70-
pub target_addr: SocketAddr,
7168
pub policy: RouteAuthzLabels,
7269
}
7370

@@ -99,9 +96,7 @@ pub struct RouteAuthzLabels {
9996
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
10097
pub struct OutboundEndpointLabels {
10198
pub server_id: tls::ConditionalClientTls,
102-
pub authority: Option<http::uri::Authority>,
10399
pub labels: Option<String>,
104-
pub target_addr: SocketAddr,
105100
}
106101

107102
#[derive(Clone, Debug, PartialEq, Eq, Hash)]

linkerd/app/inbound/src/http/router.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,6 @@ impl Param<metrics::EndpointLabels> for Logical {
391391
fn param(&self) -> metrics::EndpointLabels {
392392
metrics::InboundEndpointLabels {
393393
tls: self.tls.clone(),
394-
authority: self.logical.as_ref().map(|d| d.as_http_authority()),
395-
target_addr: self.addr.into(),
396394
policy: self.permit.labels.clone(),
397395
}
398396
.into()

linkerd/app/inbound/src/http/tests.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,6 @@ async fn grpc_response_class() {
522522
.get_response_total(
523523
&metrics::EndpointLabels::Inbound(metrics::InboundEndpointLabels {
524524
tls: Target::meshed_h2().1,
525-
authority: Some("foo.svc.cluster.local:5550".parse().unwrap()),
526-
target_addr: "127.0.0.1:80".parse().unwrap(),
527525
policy: metrics::RouteAuthzLabels {
528526
route: metrics::RouteLabels {
529527
server: metrics::ServerLabel(Arc::new(policy::Meta::Resource {

linkerd/app/integration/src/tests/telemetry.rs

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -266,30 +266,20 @@ async fn admin_transport_metrics() {
266266
);
267267
}
268268

269-
#[tokio::test]
270-
async fn metrics_endpoint_inbound_request_count() {
271-
test_http_count("request_total", "inbound", Fixture::inbound()).await;
272-
}
273-
274269
#[tokio::test]
275270
async fn metrics_endpoint_outbound_request_count() {
276-
test_http_count("request_total", "outbound", Fixture::outbound()).await
277-
}
278-
279-
#[tokio::test]
280-
async fn metrics_endpoint_inbound_response_count() {
281-
test_http_count("response_total", "inbound", Fixture::inbound()).await;
271+
test_http_count("request_total", Fixture::outbound(), 1u64).await
282272
}
283273

284274
#[tokio::test]
285275
async fn metrics_endpoint_outbound_response_count() {
286-
test_http_count("response_total", "outbound", Fixture::outbound()).await
276+
test_http_count("response_total", Fixture::outbound(), 1u64).await
287277
}
288278

289279
async fn test_http_count(
290280
metric: &str,
291-
traffic_direction: &str,
292281
fixture: impl Future<Output = Fixture>,
282+
expected_count: u64,
293283
) {
294284
let _trace = trace_init();
295285
let Fixture {
@@ -303,23 +293,12 @@ async fn test_http_count(
303293
..
304294
} = fixture.await;
305295

306-
// Add extra cardinality for http counts test only to make sure the test server doesn't to +=1
307-
// to existing metrics after the target_addr label is removed.
308-
// The combinations are inbound_request, inbound_response, outbound_request, outbound_response
309-
let expected_labels = labels.clone().label(
310-
"test_case",
311-
format!("{}_{}", "dst_deployment", traffic_direction),
312-
);
313-
314-
let metric = expected_labels.metric(metric);
315-
316-
assert!(metric.is_not_in(metrics.get("/metrics").await));
296+
let metric = labels.metric(metric);
317297

318298
info!("client.get(/)");
319299
assert_eq!(client.get("/").await, "hello");
320300

321-
// after seeing a request, the request count should be 1.
322-
metric.value(1u64).assert_in(&metrics).await;
301+
metric.value(expected_count).assert_in(&metrics).await;
323302
}
324303

325304
mod response_classification {
@@ -407,7 +386,6 @@ mod response_classification {
407386
"success"
408387
},
409388
)
410-
.value(1u64)
411389
.assert_in(&metrics)
412390
.await;
413391
}
@@ -1196,10 +1174,9 @@ async fn metrics_compression() {
11961174
info!("client.get(/)");
11971175
assert_eq!(client.get("/").await, "hello");
11981176

1199-
let mut metric = labels
1177+
let metric = labels
12001178
.metric("response_latency_ms_count")
1201-
.label("status_code", 200)
1202-
.value(1u64);
1179+
.label("status_code", 200);
12031180

12041181
for &encoding in encodings {
12051182
assert_eventually_contains!(do_scrape(encoding).await, &metric);
@@ -1209,6 +1186,6 @@ async fn metrics_compression() {
12091186
assert_eq!(client.get("/").await, "hello");
12101187

12111188
for &encoding in encodings {
1212-
assert_eventually_contains!(do_scrape(encoding).await, metric.set_value(2u64));
1189+
assert_eventually_contains!(do_scrape(encoding).await, metric);
12131190
}
12141191
}

linkerd/app/outbound/src/http/concrete.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,8 @@ where
210210
{
211211
fn param(&self) -> OutboundEndpointLabels {
212212
OutboundEndpointLabels {
213-
authority: self.parent.param(),
214213
labels: prefix_outbound_endpoint_labels("dst", self.metadata.labels().iter()),
215214
server_id: self.param(),
216-
target_addr: self.addr.into(),
217215
}
218216
}
219217
}

linkerd/app/outbound/src/http/endpoint/tests.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,8 @@ impl svc::Param<transport::labels::Key> for Endpoint {
298298
impl svc::Param<metrics::OutboundEndpointLabels> for Endpoint {
299299
fn param(&self) -> metrics::OutboundEndpointLabels {
300300
metrics::OutboundEndpointLabels {
301-
authority: None,
302301
labels: None,
303302
server_id: self.param(),
304-
target_addr: self.addr.into(),
305303
}
306304
}
307305
}

linkerd/app/outbound/src/opaq/concrete.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -315,16 +315,9 @@ where
315315
T: svc::Param<Option<profiles::LogicalAddr>>,
316316
{
317317
fn param(&self) -> metrics::OutboundEndpointLabels {
318-
let authority = self
319-
.parent
320-
.param()
321-
.as_ref()
322-
.map(|profiles::LogicalAddr(a)| a.as_http_authority());
323318
metrics::OutboundEndpointLabels {
324-
authority,
325319
labels: metrics::prefix_outbound_endpoint_labels("dst", self.metadata.labels().iter()),
326320
server_id: self.param(),
327-
target_addr: self.addr.into(),
328321
}
329322
}
330323
}

0 commit comments

Comments
 (0)