Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize for personio use case #5

Open
wants to merge 3 commits into
base: release/v2.152.0-official
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion linkerd/app/admin/src/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ impl Param<metrics::EndpointLabels> for Http {
metrics::InboundEndpointLabels {
tls: self.tcp.tls.clone(),
authority: None,
target_addr: self.tcp.addr.into(),
}
.into()
}
Expand Down
10 changes: 3 additions & 7 deletions linkerd/app/core/src/metrics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ use crate::{
telemetry, tls,
transport::{
self,
labels::{TargetAddr, TlsAccept, TlsConnect},
labels::{TlsAccept, TlsConnect},
},
};
use linkerd_addr::Addr;
use linkerd_metrics::FmtLabels;
pub use linkerd_metrics::*;
use std::{
fmt::{self, Write},
net::SocketAddr,
time::{Duration, SystemTime},
};

Expand Down Expand Up @@ -66,15 +65,13 @@ pub enum EndpointLabels {
pub struct InboundEndpointLabels {
pub tls: tls::ConditionalServerTls,
pub authority: Option<http::uri::Authority>,
pub target_addr: SocketAddr,
}

#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct OutboundEndpointLabels {
pub server_id: tls::ConditionalClientTls,
pub authority: Option<http::uri::Authority>,
pub labels: Option<String>,
pub target_addr: SocketAddr,
}

#[derive(Clone, Debug, PartialEq, Eq, Hash)]
Expand Down Expand Up @@ -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(())
}
Expand All @@ -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)?;
Expand Down
4 changes: 2 additions & 2 deletions linkerd/app/inbound/src/http/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,10 @@ impl Param<transport::labels::Key> for Logical {

impl Param<metrics::EndpointLabels> 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()),
target_addr: self.addr.into(),
authority: Some(authority),
}
.into()
}
Expand Down
15 changes: 8 additions & 7 deletions linkerd/app/outbound/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,16 @@ impl<P> svc::Param<transport::labels::Key> for Endpoint<P> {

impl<P> svc::Param<metrics::OutboundEndpointLabels> for Endpoint<P> {
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");

let mut dst_labels = self.metadata.labels().clone();
dst_labels.remove("pod");
dst_labels.remove("pod_template_hash");

metrics::OutboundEndpointLabels {
authority,
labels: metrics::prefix_labels("dst", self.metadata.labels().iter()),
authority: Some(authority),
labels: metrics::prefix_labels("dst", dst_labels.iter()),
server_id: self.tls.clone(),
target_addr: self.addr.into(),
}
}
}
Expand Down