Skip to content

Commit 030fa28

Browse files
authored
fix: remove ambiguous metrics registry keys (#3987)
### 🖼️ background the linkerd2 proxy implements, registers, and exports Prometheus metrics using a variety of systems, for historical reasons. new metrics broadly rely upon the official [`prometheus-client`](https://github.com/prometheus/client_rust/) library, whose interfaces are reexported for internal consumption in the [`linkerd_metrics::prom`](https://github.com/linkerd/linkerd2-proxy/blob/main/linkerd/metrics/src/lib.rs#L30-L60) namespace. other metrics predate this library however, and rely on the metrics registry implemented in the workspace's [`linkerd-metrics`](https://github.com/linkerd/linkerd2-proxy/tree/main/linkerd/metrics) library. ### 🐛 bug report * linkerd/linkerd2#13821 linkerd/linkerd2#13821 reported a bug in which duplicate metrics could be observed and subsequently dropped by Prometheus when upgrading the control plane via helm with an existing workload running. ### 🦋 reproduction example for posterity, i'll note the reproduction steps here. i used these steps to identify the `2025.3.2` edge release as the affected release. upgrading from `2025.2.3` to `2025.3.1` did not exhibit this behavior. see below for more discussion about the cause. generate certificates via <https://linkerd.io/2.18/tasks/generate-certificates/> using these two deployments, courtesy of @GTRekter: <details> <summary>**💾 click to expand: app deployment**</summary> ```yaml apiVersion: v1 kind: Namespace metadata: name: simple-app annotations: linkerd.io/inject: enabled --- apiVersion: v1 kind: Service metadata: name: simple-app-v1 namespace: simple-app spec: selector: app: simple-app-v1 version: v1 ports: - port: 80 targetPort: 5678 --- apiVersion: apps/v1 kind: Deployment metadata: name: simple-app-v1 namespace: simple-app spec: replicas: 1 selector: matchLabels: app: simple-app-v1 version: v1 template: metadata: labels: app: simple-app-v1 version: v1 spec: containers: - name: http-app image: hashicorp/http-echo:latest args: - "-text=Simple App v1" ports: - containerPort: 5678 ``` </details> <details> <summary>**🤠 click to expand: client deployment**</summary> ```yaml apiVersion: apps/v1 kind: Deployment metadata: name: traffic namespace: simple-app spec: replicas: 1 selector: matchLabels: app: traffic template: metadata: labels: app: traffic spec: containers: - name: traffic image: curlimages/curl:latest command: - /bin/sh - -c - | while true; do TIMESTAMP_SEND=$(date '+%Y-%m-%d %H:%M:%S') PAYLOAD="{\"timestamp\":\"$TIMESTAMP_SEND\",\"test_id\":\"sniff_me\",\"message\":\"hello-world\"}" echo "$TIMESTAMP_SEND - Sending payload: $PAYLOAD" RESPONSE=$(curl -s -X POST \ -H "Content-Type: application/json" \ -d "$PAYLOAD" \ http://simple-app-v1.simple-app.svc.cluster.local:80) TIMESTAMP_RESPONSE=$(date '+%Y-%m-%d %H:%M:%S') echo "$TIMESTAMP_RESPONSE - RESPONSE: $RESPONSE" sleep 1 done ``` </details> and this prometheus configuration: <details> <summary>**🔥 click to expand: prometheus configuration**</summary> ```yaml global: scrape_interval: 10s scrape_configs: - job_name: 'pod' scrape_interval: 10s static_configs: - targets: ['localhost:4191'] labels: group: 'traffic' ``` </details> we will perform the following steps: ```sh # install the edge release # specify the versions we'll migrate between. export FROM="2025.3.1" export TO="2025.3.2" # create a cluster, and add the helm charts. kind create cluster helm repo add linkerd-edge https://helm.linkerd.io/edge # install linkerd's crd's and control plane. helm install linkerd-crds linkerd-edge/linkerd-crds \ -n linkerd --create-namespace --version $FROM helm install linkerd-control-plane \ -n linkerd \ --set-file identityTrustAnchorsPEM=cert/ca.crt \ --set-file identity.issuer.tls.crtPEM=cert/issuer.crt \ --set-file identity.issuer.tls.keyPEM=cert/issuer.key \ --version $FROM \ linkerd-edge/linkerd-control-plane # install a simple app and a client to drive traffic. kubectl apply -f duplicate-metrics-simple-app.yml kubectl apply -f duplicate-metrics-traffic.yml # bind the traffic pod's metrics port to the host. kubectl port-forward -n simple-app deploy/traffic 4191 # start prometheus, begin scraping metrics prometheus --config.file=prometheus.yml ``` now, open a browser and query `irate(request_total[1m])`. next, upgrade the control plane: ``` helm upgrade linkerd-crds linkerd-edge/linkerd-crds \ -n linkerd --create-namespace --version $TO helm upgrade linkerd-control-plane \ -n linkerd \ --set-file identityTrustAnchorsPEM=cert/ca.crt \ --set-file identity.issuer.tls.crtPEM=cert/issuer.crt \ --set-file identity.issuer.tls.keyPEM=cert/issuer.key \ --version $TO \ linkerd-edge/linkerd-control-plane ``` prometheus will begin emitting warnings regarding 34 time series being dropped. in your browser, querying `irate(request_total[1m])` once more will show that the rate of requests has stopped, due to the new time series being dropped. next, restart the workloads... ``` kubectl rollout restart deployment -n simple-app simple-app-v1 traffic ``` prometheus warnings will go away, as reported in linkerd/linkerd2#13821. ### 🔍 related changes * linkerd/linkerd2#13699 * linkerd/linkerd2#13715 in linkerd/linkerd2#13715 and linkerd/linkerd2##13699, we made some changes to the destination controller. from the "Cautions" section of the `2025.3.2` edge release: > Additionally, this release changes the default for `outbound-transport-mode` > to `transport-header`, which will result in all traffic between meshed > proxies flowing on port 4143, rather than using the original destination > port. linkerd/linkerd2#13699 (_included in `edge-25.3.1`_) introduced this outbound transport-protocol configuration surface, but maintained the default behavior, while linkerd/linkerd2#13715 (_included in `edge-25.3.2`_) altered the default behavior to route meshed traffic via port 4143. this is a visible change in behavior that can be observed when upgrading from a version that preceded this change to the mesh. this means that when upgrading across `edge-25.3.2`, such as from the `2025.2.1` to `2025.3.2` versions of the helm charts, or from the `2025.2.3` to the `2025.3.4` versions of the helm charts (_reported upstream in linkerd/linkerd2#13821_), the freshly upgraded destination controller pods will begin routing meshed traffic differently. i'll state explicitly, _that_ is not a bug! it is, however, an important clue to bear in mind: data plane pods that were started with the previous control plane version, and continue running after the control plane upgrade, will have seen both routing patterns. reporting a duplicate time series for affected metrics indicates that there is a hashing collision in our metrics system. ### 🐛 the bug(s) we define a collection to structures to model labels for inbound and outbound endpoints' metrics: ```rust // linkerd/app/core/src/metrics.rs #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub enum EndpointLabels { Inbound(InboundEndpointLabels), Outbound(OutboundEndpointLabels), } #[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, } #[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 zone_locality: OutboundZoneLocality, pub target_addr: SocketAddr, } ``` \- <https://github.com/linkerd/linkerd2-proxy/blob/main/linkerd/app/core/src/metrics.rs> bear particular attention to the derived `Hash` implementation. note the `tls::ConditionalClientTls` and `tls::ConditionalServerTls` types used in each of these labels. these are used by some of our types like `TlsConnect` to emit prometheus labels, using our legacy system's `FmtLabels` trait: ```rust // linkerd/app/core/src/transport/labels.rs impl FmtLabels for TlsConnect<'_> { fn fmt_labels(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self.0 { Conditional::None(tls::NoClientTls::Disabled) => { write!(f, "tls=\"disabled\"") } Conditional::None(why) => { write!(f, "tls=\"no_identity\",no_tls_reason=\"{}\"", why) } Conditional::Some(tls::ClientTls { server_id, .. }) => { write!(f, "tls=\"true\",server_id=\"{}\"", server_id) } } } } ``` \- <https://github.com/linkerd/linkerd2-proxy/blob/99316f78987975a074ea63453c0dd21546fa4a48/linkerd/app/core/src/transport/labels.rs#L151-L165> note the `ClientTls` case, which ignores fields in the client tls information: ```rust // linkerd/tls/src/client.rs /// A stack parameter that configures a `Client` to establish a TLS connection. #[derive(Clone, Debug, Eq, PartialEq, Hash)] pub struct ClientTls { pub server_name: ServerName, pub server_id: ServerId, pub alpn: Option<AlpnProtocols>, } ``` \- <https://github.com/linkerd/linkerd2-proxy/blob/99316f78987975a074ea63453c0dd21546fa4a48/linkerd/tls/src/client.rs#L20-L26> this means that there is potential for an identical set of labels to be emitted given two `ClientTls` structures with distinct server names or ALPN protocols. for brevity, i'll elide the equivalent issue with `ServerTls`, and its corresponding `TlsAccept<'_>` label implementation, though it exhibits the same issue. ### 🔨 the fix this pull request introduces two new types: `ClientTlsLabels` and `ServerTlsLabels`. these continue to implement `Hash`, for use as a key in our metrics registry, and for use in formatting labels. `ClientTlsLabels` and `ServerTlsLabels` each resemble `ClientTls` and `ServerTls`, respectively, but do not contain any fields that are elided in label formatting, to prevent duplicate metrics from being emitted. relatedly, #3988 audits our existing `FmtLabels` implementations and makes use of exhaustive bindings, to prevent this category of problem in the short-term future. ideally, we might eventually consider replacing the metrics interfaces in `linkerd-metrics`, but that is strictly kept out-of-scope for the purposes of this particular fix. --- * fix: do not key transport metrics registry on `ClientTls` Signed-off-by: katelyn martin <kate@buoyant.io> * fix: do not key transport metrics registry on `ServerTls` Signed-off-by: katelyn martin <kate@buoyant.io> --------- Signed-off-by: katelyn martin <kate@buoyant.io>
1 parent 085be99 commit 030fa28

File tree

17 files changed

+143
-56
lines changed

17 files changed

+143
-56
lines changed

linkerd/app/admin/src/stack.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ impl Config {
214214
impl Param<transport::labels::Key> for Tcp {
215215
fn param(&self) -> transport::labels::Key {
216216
transport::labels::Key::inbound_server(
217-
self.tls.clone(),
217+
self.tls.as_ref().map(|t| t.labels()),
218218
self.addr.into(),
219219
self.policy.server_label(),
220220
)
@@ -272,7 +272,7 @@ impl Param<metrics::ServerLabel> for Http {
272272
impl Param<metrics::EndpointLabels> for Permitted {
273273
fn param(&self) -> metrics::EndpointLabels {
274274
metrics::InboundEndpointLabels {
275-
tls: self.http.tcp.tls.clone(),
275+
tls: self.http.tcp.tls.as_ref().map(|t| t.labels()),
276276
authority: None,
277277
target_addr: self.http.tcp.addr.into(),
278278
policy: self.permit.labels.clone(),

linkerd/app/core/src/metrics.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub struct Proxy {
5454
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
5555
pub struct ControlLabels {
5656
addr: Addr,
57-
server_id: tls::ConditionalClientTls,
57+
server_id: tls::ConditionalClientTlsLabels,
5858
}
5959

6060
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
@@ -65,7 +65,7 @@ pub enum EndpointLabels {
6565

6666
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
6767
pub struct InboundEndpointLabels {
68-
pub tls: tls::ConditionalServerTls,
68+
pub tls: tls::ConditionalServerTlsLabels,
6969
pub authority: Option<http::uri::Authority>,
7070
pub target_addr: SocketAddr,
7171
pub policy: RouteAuthzLabels,
@@ -98,7 +98,7 @@ pub struct RouteAuthzLabels {
9898

9999
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
100100
pub struct OutboundEndpointLabels {
101-
pub server_id: tls::ConditionalClientTls,
101+
pub server_id: tls::ConditionalClientTlsLabels,
102102
pub authority: Option<http::uri::Authority>,
103103
pub labels: Option<String>,
104104
pub zone_locality: OutboundZoneLocality,
@@ -243,7 +243,7 @@ impl svc::Param<ControlLabels> for control::ControlAddr {
243243
fn param(&self) -> ControlLabels {
244244
ControlLabels {
245245
addr: self.addr.clone(),
246-
server_id: self.identity.clone(),
246+
server_id: self.identity.as_ref().map(tls::ClientTls::labels),
247247
}
248248
}
249249
}

linkerd/app/core/src/transport/labels.rs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ pub enum Key {
2020
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
2121
pub struct ServerLabels {
2222
direction: Direction,
23-
tls: tls::ConditionalServerTls,
23+
tls: tls::ConditionalServerTlsLabels,
2424
target_addr: SocketAddr,
2525
policy: Option<PolicyServerLabel>,
2626
}
2727

2828
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
29-
pub struct TlsAccept<'t>(pub &'t tls::ConditionalServerTls);
29+
pub struct TlsAccept<'t>(pub &'t tls::ConditionalServerTlsLabels);
3030

3131
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
32-
pub(crate) struct TlsConnect<'t>(&'t tls::ConditionalClientTls);
32+
pub(crate) struct TlsConnect<'t>(pub &'t tls::ConditionalClientTlsLabels);
3333

3434
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
3535
pub struct TargetAddr(pub SocketAddr);
@@ -38,7 +38,7 @@ pub struct TargetAddr(pub SocketAddr);
3838

3939
impl Key {
4040
pub fn inbound_server(
41-
tls: tls::ConditionalServerTls,
41+
tls: tls::ConditionalServerTlsLabels,
4242
target_addr: SocketAddr,
4343
server: PolicyServerLabel,
4444
) -> Self {
@@ -62,7 +62,7 @@ impl FmtLabels for Key {
6262
}
6363

6464
Self::InboundClient => {
65-
const NO_TLS: tls::client::ConditionalClientTls =
65+
const NO_TLS: tls::client::ConditionalClientTlsLabels =
6666
Conditional::None(tls::NoClientTls::Loopback);
6767

6868
Direction::In.fmt_labels(f)?;
@@ -75,7 +75,7 @@ impl FmtLabels for Key {
7575

7676
impl ServerLabels {
7777
fn inbound(
78-
tls: tls::ConditionalServerTls,
78+
tls: tls::ConditionalServerTlsLabels,
7979
target_addr: SocketAddr,
8080
policy: PolicyServerLabel,
8181
) -> Self {
@@ -90,7 +90,7 @@ impl ServerLabels {
9090
fn outbound(target_addr: SocketAddr) -> Self {
9191
ServerLabels {
9292
direction: Direction::Out,
93-
tls: tls::ConditionalServerTls::None(tls::NoServerTls::Loopback),
93+
tls: tls::ConditionalServerTlsLabels::None(tls::NoServerTls::Loopback),
9494
target_addr,
9595
policy: None,
9696
}
@@ -114,8 +114,8 @@ impl FmtLabels for ServerLabels {
114114

115115
// === impl TlsAccept ===
116116

117-
impl<'t> From<&'t tls::ConditionalServerTls> for TlsAccept<'t> {
118-
fn from(c: &'t tls::ConditionalServerTls) -> Self {
117+
impl<'t> From<&'t tls::ConditionalServerTlsLabels> for TlsAccept<'t> {
118+
fn from(c: &'t tls::ConditionalServerTlsLabels) -> Self {
119119
TlsAccept(c)
120120
}
121121
}
@@ -129,11 +129,11 @@ impl FmtLabels for TlsAccept<'_> {
129129
Conditional::None(why) => {
130130
write!(f, "tls=\"no_identity\",no_tls_reason=\"{}\"", why)
131131
}
132-
Conditional::Some(tls::ServerTls::Established { client_id, .. }) => match client_id {
132+
Conditional::Some(tls::ServerTlsLabels::Established { client_id }) => match client_id {
133133
Some(id) => write!(f, "tls=\"true\",client_id=\"{}\"", id),
134134
None => write!(f, "tls=\"true\",client_id=\"\""),
135135
},
136-
Conditional::Some(tls::ServerTls::Passthru { sni }) => {
136+
Conditional::Some(tls::ServerTlsLabels::Passthru { sni }) => {
137137
write!(f, "tls=\"opaque\",sni=\"{}\"", sni)
138138
}
139139
}
@@ -142,22 +142,24 @@ impl FmtLabels for TlsAccept<'_> {
142142

143143
// === impl TlsConnect ===
144144

145-
impl<'t> From<&'t tls::ConditionalClientTls> for TlsConnect<'t> {
146-
fn from(s: &'t tls::ConditionalClientTls) -> Self {
145+
impl<'t> From<&'t tls::ConditionalClientTlsLabels> for TlsConnect<'t> {
146+
fn from(s: &'t tls::ConditionalClientTlsLabels) -> Self {
147147
TlsConnect(s)
148148
}
149149
}
150150

151151
impl FmtLabels for TlsConnect<'_> {
152152
fn fmt_labels(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
153-
match self.0 {
153+
let Self(tls) = self;
154+
155+
match tls {
154156
Conditional::None(tls::NoClientTls::Disabled) => {
155157
write!(f, "tls=\"disabled\"")
156158
}
157159
Conditional::None(why) => {
158160
write!(f, "tls=\"no_identity\",no_tls_reason=\"{}\"", why)
159161
}
160-
Conditional::Some(tls::ClientTls { server_id, .. }) => {
162+
Conditional::Some(tls::ClientTlsLabels { server_id }) => {
161163
write!(f, "tls=\"true\",server_id=\"{}\"", server_id)
162164
}
163165
}
@@ -194,9 +196,8 @@ mod tests {
194196
use std::sync::Arc;
195197

196198
let labels = ServerLabels::inbound(
197-
tls::ConditionalServerTls::Some(tls::ServerTls::Established {
199+
tls::ConditionalServerTlsLabels::Some(tls::ServerTlsLabels::Established {
198200
client_id: Some("foo.id.example.com".parse().unwrap()),
199-
negotiated_protocol: None,
200201
}),
201202
([192, 0, 2, 4], 40000).into(),
202203
PolicyServerLabel(

linkerd/app/inbound/src/detect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ impl svc::Param<Remote<ServerAddr>> for Forward {
325325
impl svc::Param<transport::labels::Key> for Forward {
326326
fn param(&self) -> transport::labels::Key {
327327
transport::labels::Key::inbound_server(
328-
self.tls.clone(),
328+
self.tls.as_ref().map(|t| t.labels()),
329329
self.orig_dst_addr.into(),
330330
self.permit.labels.server.clone(),
331331
)
@@ -429,7 +429,7 @@ impl svc::Param<ServerLabel> for Http {
429429
impl svc::Param<transport::labels::Key> for Http {
430430
fn param(&self) -> transport::labels::Key {
431431
transport::labels::Key::inbound_server(
432-
self.tls.status.clone(),
432+
self.tls.status.as_ref().map(|t| t.labels()),
433433
self.tls.orig_dst_addr.into(),
434434
self.tls.policy.server_label(),
435435
)

linkerd/app/inbound/src/direct.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,8 @@ impl Param<Remote<ServerAddr>> for AuthorizedLocalTcp {
311311
impl Param<transport::labels::Key> for AuthorizedLocalTcp {
312312
fn param(&self) -> transport::labels::Key {
313313
transport::labels::Key::inbound_server(
314-
tls::ConditionalServerTls::Some(tls::ServerTls::Established {
314+
tls::ConditionalServerTlsLabels::Some(tls::ServerTlsLabels::Established {
315315
client_id: Some(self.client_id.clone()),
316-
negotiated_protocol: None,
317316
}),
318317
self.addr.into(),
319318
self.permit.labels.server.clone(),
@@ -344,9 +343,8 @@ impl Param<Remote<ClientAddr>> for LocalHttp {
344343
impl Param<transport::labels::Key> for LocalHttp {
345344
fn param(&self) -> transport::labels::Key {
346345
transport::labels::Key::inbound_server(
347-
tls::ConditionalServerTls::Some(tls::ServerTls::Established {
346+
tls::ConditionalServerTlsLabels::Some(tls::ServerTlsLabels::Established {
348347
client_id: Some(self.client.client_id.clone()),
349-
negotiated_protocol: None,
350348
}),
351349
self.addr.into(),
352350
self.policy.server_label(),
@@ -435,6 +433,14 @@ impl Param<tls::ConditionalServerTls> for GatewayTransportHeader {
435433
}
436434
}
437435

436+
impl Param<tls::ConditionalServerTlsLabels> for GatewayTransportHeader {
437+
fn param(&self) -> tls::ConditionalServerTlsLabels {
438+
tls::ConditionalServerTlsLabels::Some(tls::ServerTlsLabels::Established {
439+
client_id: Some(self.client.client_id.clone()),
440+
})
441+
}
442+
}
443+
438444
impl Param<tls::ClientId> for GatewayTransportHeader {
439445
fn param(&self) -> tls::ClientId {
440446
self.client.client_id.clone()

linkerd/app/inbound/src/http/router.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ fn endpoint_labels(
395395
) -> impl svc::ExtractParam<metrics::EndpointLabels, Logical> + Clone {
396396
move |t: &Logical| -> metrics::EndpointLabels {
397397
metrics::InboundEndpointLabels {
398-
tls: t.tls.clone(),
398+
tls: t.tls.as_ref().map(|t| t.labels()),
399399
authority: unsafe_authority_labels
400400
.then(|| t.logical.as_ref().map(|d| d.as_http_authority()))
401401
.flatten(),

linkerd/app/inbound/src/http/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ async fn grpc_response_class() {
664664
let response_total = metrics
665665
.get_response_total(
666666
&metrics::EndpointLabels::Inbound(metrics::InboundEndpointLabels {
667-
tls: Target::meshed_h2().1,
667+
tls: Target::meshed_h2().1.map(|t| t.labels()),
668668
authority: None,
669669
target_addr: "127.0.0.1:80".parse().unwrap(),
670670
policy: metrics::RouteAuthzLabels {
@@ -762,7 +762,7 @@ async fn test_unsafe_authority_labels(
762762
let response_total = metrics
763763
.get_response_total(
764764
&metrics::EndpointLabels::Inbound(metrics::InboundEndpointLabels {
765-
tls: Target::meshed_http1().1,
765+
tls: Target::meshed_http1().1.as_ref().map(|t| t.labels()),
766766
authority: expected_authority,
767767
target_addr: "127.0.0.1:80".parse().unwrap(),
768768
policy: metrics::RouteAuthzLabels {

linkerd/app/inbound/src/metrics/authz.rs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub struct HTTPLocalRateLimitLabels {
6767
#[derive(Debug, Hash, PartialEq, Eq)]
6868
struct Key<L> {
6969
target: TargetAddr,
70-
tls: tls::ConditionalServerTls,
70+
tls: tls::ConditionalServerTlsLabels,
7171
labels: L,
7272
}
7373

@@ -80,7 +80,7 @@ type HttpLocalRateLimitKey = Key<HTTPLocalRateLimitLabels>;
8080
// === impl HttpAuthzMetrics ===
8181

8282
impl HttpAuthzMetrics {
83-
pub fn allow(&self, permit: &HttpRoutePermit, tls: tls::ConditionalServerTls) {
83+
pub fn allow(&self, permit: &HttpRoutePermit, tls: tls::ConditionalServerTlsLabels) {
8484
self.0
8585
.allow
8686
.lock()
@@ -93,7 +93,7 @@ impl HttpAuthzMetrics {
9393
&self,
9494
labels: ServerLabel,
9595
dst: OrigDstAddr,
96-
tls: tls::ConditionalServerTls,
96+
tls: tls::ConditionalServerTlsLabels,
9797
) {
9898
self.0
9999
.route_not_found
@@ -103,7 +103,12 @@ impl HttpAuthzMetrics {
103103
.incr();
104104
}
105105

106-
pub fn deny(&self, labels: RouteLabels, dst: OrigDstAddr, tls: tls::ConditionalServerTls) {
106+
pub fn deny(
107+
&self,
108+
labels: RouteLabels,
109+
dst: OrigDstAddr,
110+
tls: tls::ConditionalServerTlsLabels,
111+
) {
107112
self.0
108113
.deny
109114
.lock()
@@ -116,7 +121,7 @@ impl HttpAuthzMetrics {
116121
&self,
117122
labels: HTTPLocalRateLimitLabels,
118123
dst: OrigDstAddr,
119-
tls: tls::ConditionalServerTls,
124+
tls: tls::ConditionalServerTlsLabels,
120125
) {
121126
self.0
122127
.http_local_rate_limit
@@ -187,7 +192,7 @@ impl FmtMetrics for HttpAuthzMetrics {
187192
// === impl TcpAuthzMetrics ===
188193

189194
impl TcpAuthzMetrics {
190-
pub fn allow(&self, permit: &ServerPermit, tls: tls::ConditionalServerTls) {
195+
pub fn allow(&self, permit: &ServerPermit, tls: tls::ConditionalServerTlsLabels) {
191196
self.0
192197
.allow
193198
.lock()
@@ -196,7 +201,7 @@ impl TcpAuthzMetrics {
196201
.incr();
197202
}
198203

199-
pub fn deny(&self, policy: &AllowPolicy, tls: tls::ConditionalServerTls) {
204+
pub fn deny(&self, policy: &AllowPolicy, tls: tls::ConditionalServerTlsLabels) {
200205
self.0
201206
.deny
202207
.lock()
@@ -205,7 +210,7 @@ impl TcpAuthzMetrics {
205210
.incr();
206211
}
207212

208-
pub fn terminate(&self, policy: &AllowPolicy, tls: tls::ConditionalServerTls) {
213+
pub fn terminate(&self, policy: &AllowPolicy, tls: tls::ConditionalServerTlsLabels) {
209214
self.0
210215
.terminate
211216
.lock()
@@ -265,7 +270,7 @@ impl FmtLabels for HTTPLocalRateLimitLabels {
265270
// === impl Key ===
266271

267272
impl<L> Key<L> {
268-
fn new(labels: L, dst: OrigDstAddr, tls: tls::ConditionalServerTls) -> Self {
273+
fn new(labels: L, dst: OrigDstAddr, tls: tls::ConditionalServerTlsLabels) -> Self {
269274
Self {
270275
tls,
271276
target: TargetAddr(dst.into()),
@@ -281,19 +286,19 @@ impl<L: FmtLabels> FmtLabels for Key<L> {
281286
}
282287

283288
impl ServerKey {
284-
fn from_policy(policy: &AllowPolicy, tls: tls::ConditionalServerTls) -> Self {
289+
fn from_policy(policy: &AllowPolicy, tls: tls::ConditionalServerTlsLabels) -> Self {
285290
Self::new(policy.server_label(), policy.dst_addr(), tls)
286291
}
287292
}
288293

289294
impl RouteAuthzKey {
290-
fn from_permit(permit: &HttpRoutePermit, tls: tls::ConditionalServerTls) -> Self {
295+
fn from_permit(permit: &HttpRoutePermit, tls: tls::ConditionalServerTlsLabels) -> Self {
291296
Self::new(permit.labels.clone(), permit.dst, tls)
292297
}
293298
}
294299

295300
impl ServerAuthzKey {
296-
fn from_permit(permit: &ServerPermit, tls: tls::ConditionalServerTls) -> Self {
301+
fn from_permit(permit: &ServerPermit, tls: tls::ConditionalServerTlsLabels) -> Self {
297302
Self::new(permit.labels.clone(), permit.dst, tls)
298303
}
299304
}

0 commit comments

Comments
 (0)