From aac4a9e444e965350c241310a4e71087f151dc88 Mon Sep 17 00:00:00 2001 From: Bruce Date: Wed, 25 Aug 2021 14:04:09 +0200 Subject: [PATCH 1/3] Hardcode metric label "authority" to "personio.de" --- linkerd/app/inbound/src/http/router.rs | 3 ++- linkerd/app/outbound/src/endpoint.rs | 7 ++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/linkerd/app/inbound/src/http/router.rs b/linkerd/app/inbound/src/http/router.rs index 2cd571fe8e..91c0c23319 100644 --- a/linkerd/app/inbound/src/http/router.rs +++ b/linkerd/app/inbound/src/http/router.rs @@ -299,9 +299,10 @@ impl Param for Logical { impl Param for Logical { fn param(&self) -> metrics::EndpointLabels { + let authority = http::uri::Authority::from_static("personio.de"); metrics::InboundEndpointLabels { tls: self.tls.clone(), - authority: self.logical.as_ref().map(|d| d.as_http_authority()), + authority: Some(authority), target_addr: self.addr.into(), } .into() diff --git a/linkerd/app/outbound/src/endpoint.rs b/linkerd/app/outbound/src/endpoint.rs index 7402758364..facf416238 100644 --- a/linkerd/app/outbound/src/endpoint.rs +++ b/linkerd/app/outbound/src/endpoint.rs @@ -102,12 +102,9 @@ impl

svc::Param for Endpoint

{ impl

svc::Param for Endpoint

{ fn param(&self) -> metrics::OutboundEndpointLabels { - let authority = self - .logical_addr - .as_ref() - .map(|LogicalAddr(a)| a.as_http_authority()); + let authority = http::uri::Authority::from_static("personio.de"); metrics::OutboundEndpointLabels { - authority, + authority: Some(authority), labels: metrics::prefix_labels("dst", self.metadata.labels().iter()), server_id: self.tls.clone(), target_addr: self.addr.into(), From dd9f31b252000458c643cbc454bf4df793e2a393 Mon Sep 17 00:00:00 2001 From: Bruce Date: Mon, 29 Nov 2021 14:28:37 +0100 Subject: [PATCH 2/3] Remove target_addr from proxy metrics --- linkerd/app/admin/src/stack.rs | 1 - linkerd/app/core/src/metrics/mod.rs | 10 +++------- linkerd/app/inbound/src/http/router.rs | 1 - linkerd/app/outbound/src/endpoint.rs | 1 - 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/linkerd/app/admin/src/stack.rs b/linkerd/app/admin/src/stack.rs index 807129cc59..408f32a77e 100644 --- a/linkerd/app/admin/src/stack.rs +++ b/linkerd/app/admin/src/stack.rs @@ -178,7 +178,6 @@ impl Param for Http { metrics::InboundEndpointLabels { tls: self.tcp.tls.clone(), authority: None, - target_addr: self.tcp.addr.into(), } .into() } diff --git a/linkerd/app/core/src/metrics/mod.rs b/linkerd/app/core/src/metrics/mod.rs index 8fe299efb2..8ec22ef627 100644 --- a/linkerd/app/core/src/metrics/mod.rs +++ b/linkerd/app/core/src/metrics/mod.rs @@ -8,7 +8,7 @@ use crate::{ telemetry, tls, transport::{ self, - labels::{TargetAddr, TlsAccept, TlsConnect}, + labels::{TlsAccept, TlsConnect}, }, }; use linkerd_addr::Addr; @@ -16,7 +16,6 @@ use linkerd_metrics::FmtLabels; pub use linkerd_metrics::*; use std::{ fmt::{self, Write}, - net::SocketAddr, time::{Duration, SystemTime}, }; @@ -66,7 +65,6 @@ pub enum EndpointLabels { pub struct InboundEndpointLabels { pub tls: tls::ConditionalServerTls, pub authority: Option, - pub target_addr: SocketAddr, } #[derive(Clone, Debug, PartialEq, Eq, Hash)] @@ -74,7 +72,6 @@ pub struct OutboundEndpointLabels { pub server_id: tls::ConditionalClientTls, pub authority: Option, pub labels: Option, - pub target_addr: SocketAddr, } #[derive(Clone, Debug, PartialEq, Eq, Hash)] @@ -283,7 +280,7 @@ impl FmtLabels for InboundEndpointLabels { write!(f, ",")?; } - (TargetAddr(self.target_addr), TlsAccept::from(&self.tls)).fmt_labels(f)?; + (TlsAccept::from(&self.tls)).fmt_labels(f)?; Ok(()) } @@ -296,9 +293,8 @@ impl FmtLabels for OutboundEndpointLabels { write!(f, ",")?; } - let ta = TargetAddr(self.target_addr); let tls = TlsConnect::from(&self.server_id); - (ta, tls).fmt_labels(f)?; + tls.fmt_labels(f)?; if let Some(labels) = self.labels.as_ref() { write!(f, ",{}", labels)?; diff --git a/linkerd/app/inbound/src/http/router.rs b/linkerd/app/inbound/src/http/router.rs index 91c0c23319..9c876be4d9 100644 --- a/linkerd/app/inbound/src/http/router.rs +++ b/linkerd/app/inbound/src/http/router.rs @@ -303,7 +303,6 @@ impl Param for Logical { metrics::InboundEndpointLabels { tls: self.tls.clone(), authority: Some(authority), - target_addr: self.addr.into(), } .into() } diff --git a/linkerd/app/outbound/src/endpoint.rs b/linkerd/app/outbound/src/endpoint.rs index facf416238..03acd983c6 100644 --- a/linkerd/app/outbound/src/endpoint.rs +++ b/linkerd/app/outbound/src/endpoint.rs @@ -107,7 +107,6 @@ impl

svc::Param for Endpoint

{ authority: Some(authority), labels: metrics::prefix_labels("dst", self.metadata.labels().iter()), server_id: self.tls.clone(), - target_addr: self.addr.into(), } } } From d6a966fb023adcd116879da85c32b5177049cb3b Mon Sep 17 00:00:00 2001 From: Bruce Date: Tue, 30 Nov 2021 14:18:46 +0100 Subject: [PATCH 3/3] Remove outbound metries label: dst_pod, dst_pod_template --- linkerd/app/outbound/src/endpoint.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/linkerd/app/outbound/src/endpoint.rs b/linkerd/app/outbound/src/endpoint.rs index 03acd983c6..7793e83635 100644 --- a/linkerd/app/outbound/src/endpoint.rs +++ b/linkerd/app/outbound/src/endpoint.rs @@ -103,9 +103,14 @@ impl

svc::Param for Endpoint

{ impl

svc::Param for Endpoint

{ fn param(&self) -> metrics::OutboundEndpointLabels { let authority = http::uri::Authority::from_static("personio.de"); + + let mut dst_labels = self.metadata.labels().clone(); + dst_labels.remove("pod"); + dst_labels.remove("pod_template_hash"); + metrics::OutboundEndpointLabels { authority: Some(authority), - labels: metrics::prefix_labels("dst", self.metadata.labels().iter()), + labels: metrics::prefix_labels("dst", dst_labels.iter()), server_id: self.tls.clone(), } }