Skip to content

Commit 053c29a

Browse files
fully remove authority and target_addr in labels
1 parent cb16532 commit 053c29a

File tree

8 files changed

+12
-42
lines changed

8 files changed

+12
-42
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: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -268,28 +268,32 @@ async fn admin_transport_metrics() {
268268

269269
#[tokio::test]
270270
async fn metrics_endpoint_inbound_request_count() {
271-
test_http_count("request_total", "inbound", Fixture::inbound()).await;
271+
// For inbound traffic, as all traffic goes to the same server and we reduced cardinality,
272+
// the expected request count is 6
273+
test_http_count("request_total", Fixture::inbound(), 6u64).await;
272274
}
273275

274276
#[tokio::test]
275277
async fn metrics_endpoint_outbound_request_count() {
276-
test_http_count("request_total", "outbound", Fixture::outbound()).await
278+
test_http_count("request_total", Fixture::outbound(), 1u64).await
277279
}
278280

279281
#[tokio::test]
280282
async fn metrics_endpoint_inbound_response_count() {
281-
test_http_count("response_total", "inbound", Fixture::inbound()).await;
283+
// For inbound traffic, as all traffic goes to the same server and we reduced cardinality,
284+
// the expected request count is 6
285+
test_http_count("response_total", Fixture::inbound(), 6u64).await;
282286
}
283287

284288
#[tokio::test]
285289
async fn metrics_endpoint_outbound_response_count() {
286-
test_http_count("response_total", "outbound", Fixture::outbound()).await
290+
test_http_count("response_total", Fixture::outbound(), 1u64).await
287291
}
288292

289293
async fn test_http_count(
290294
metric: &str,
291-
traffic_direction: &str,
292295
fixture: impl Future<Output = Fixture>,
296+
expected_count: u64,
293297
) {
294298
let _trace = trace_init();
295299
let Fixture {
@@ -303,23 +307,12 @@ async fn test_http_count(
303307
..
304308
} = fixture.await;
305309

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));
310+
let metric = labels.metric(metric);
317311

318312
info!("client.get(/)");
319313
assert_eq!(client.get("/").await, "hello");
320314

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

325318
mod response_classification {
@@ -1198,8 +1191,7 @@ async fn metrics_compression() {
11981191

11991192
let mut metric = labels
12001193
.metric("response_latency_ms_count")
1201-
.label("status_code", 200)
1202-
.value(1u64);
1194+
.label("status_code", 200);
12031195

12041196
for &encoding in encodings {
12051197
assert_eventually_contains!(do_scrape(encoding).await, &metric);

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)