Skip to content

Commit

Permalink
feat(metrics)!: remove authority label on inbound metrics (#3547)
Browse files Browse the repository at this point in the history
The `authority` label is influenced by `:authority` headers and can therefore
can substantially grow in cardinality, depending on traffic patterns.

This change completely removes the authority label from inbound metrics.

Signed-off-by: Zahari Dichev <[email protected]>
  • Loading branch information
zaharidichev authored Jan 24, 2025
1 parent 1b5f7fa commit 3ab83ed
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 12 deletions.
1 change: 0 additions & 1 deletion linkerd/app/admin/src/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ impl Param<metrics::EndpointLabels> for Permitted {
fn param(&self) -> metrics::EndpointLabels {
metrics::InboundEndpointLabels {
tls: self.http.tcp.tls.clone(),
authority: None,
target_addr: self.http.tcp.addr.into(),
policy: self.permit.labels.clone(),
}
Expand Down
6 changes: 0 additions & 6 deletions linkerd/app/core/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ pub enum EndpointLabels {
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct InboundEndpointLabels {
pub tls: tls::ConditionalServerTls,
pub authority: Option<http::uri::Authority>,
pub target_addr: SocketAddr,
pub policy: RouteAuthzLabels,
}
Expand Down Expand Up @@ -317,11 +316,6 @@ impl FmtLabels for EndpointLabels {

impl FmtLabels for InboundEndpointLabels {
fn fmt_labels(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let Some(a) = self.authority.as_ref() {
Authority(a).fmt_labels(f)?;
write!(f, ",")?;
}

(
(TargetAddr(self.target_addr), TlsAccept::from(&self.tls)),
&self.policy,
Expand Down
1 change: 0 additions & 1 deletion linkerd/app/inbound/src/http/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ impl Param<metrics::EndpointLabels> for Logical {
fn param(&self) -> metrics::EndpointLabels {
metrics::InboundEndpointLabels {
tls: self.tls.clone(),
authority: self.logical.as_ref().map(|d| d.as_http_authority()),
target_addr: self.addr.into(),
policy: self.permit.labels.clone(),
}
Expand Down
1 change: 0 additions & 1 deletion linkerd/app/inbound/src/http/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,6 @@ async fn grpc_response_class() {
.get_response_total(
&metrics::EndpointLabels::Inbound(metrics::InboundEndpointLabels {
tls: Target::meshed_h2().1,
authority: Some("foo.svc.cluster.local:5550".parse().unwrap()),
target_addr: "127.0.0.1:80".parse().unwrap(),
policy: metrics::RouteAuthzLabels {
route: metrics::RouteLabels {
Expand Down
4 changes: 1 addition & 3 deletions linkerd/app/integration/src/tests/telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ impl Fixture {
let client = client::new(proxy.inbound, "tele.test.svc.cluster.local");
let tcp_dst_labels = metrics::labels().label("direction", "inbound");
let tcp_src_labels = tcp_dst_labels.clone().label("target_addr", orig_dst);
let labels = tcp_dst_labels
.clone()
.label("authority", "tele.test.svc.cluster.local");
let labels = tcp_dst_labels.clone().label("target_port", orig_dst.port());
let tcp_src_labels = tcp_src_labels.label("peer", "src");
let tcp_dst_labels = tcp_dst_labels.label("peer", "dst");
Fixture {
Expand Down

0 comments on commit 3ab83ed

Please sign in to comment.