Skip to content

Commit

Permalink
Customize for Personio's use case based on v2.186.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bruce-personio committed Sep 20, 2022
1 parent 1cd7981 commit b3a0102
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 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 @@ -224,7 +224,6 @@ impl Param<metrics::EndpointLabels> for Permitted {
metrics::InboundEndpointLabels {
tls: self.http.tcp.tls.clone(),
authority: None,
target_addr: self.http.tcp.addr.into(),
policy: self.permit.labels.clone(),
}
.into()
Expand Down
8 changes: 2 additions & 6 deletions linkerd/app/core/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pub use linkerd_metrics::*;
use linkerd_server_policy as policy;
use std::{
fmt::{self, Write},
net::SocketAddr,
sync::Arc,
time::Duration,
};
Expand Down Expand Up @@ -67,7 +66,6 @@ pub enum EndpointLabels {
pub struct InboundEndpointLabels {
pub tls: tls::ConditionalServerTls,
pub authority: Option<http::uri::Authority>,
pub target_addr: SocketAddr,
pub policy: RouteAuthzLabels,
}

Expand Down Expand Up @@ -101,7 +99,6 @@ 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 @@ -306,7 +303,7 @@ impl FmtLabels for InboundEndpointLabels {
}

(
(TargetAddr(self.target_addr), TlsAccept::from(&self.tls)),
(TlsAccept::from(&self.tls)),
&self.policy,
)
.fmt_labels(f)?;
Expand Down Expand Up @@ -373,9 +370,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
3 changes: 1 addition & 2 deletions linkerd/app/inbound/src/http/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,7 @@ 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(),
authority: None,
policy: self.permit.labels.clone(),
}
.into()
Expand Down
14 changes: 7 additions & 7 deletions linkerd/app/outbound/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ 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 dst_labels_arc = self.metadata.labels().clone();

let dst_labels_for_metrics = dst_labels_arc.iter().filter(|(k, _v)| k.as_str() != "pod" && k.as_str() != "pod_template_hash");

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

0 comments on commit b3a0102

Please sign in to comment.