Skip to content

Commit cef2ba9

Browse files
authored
outbound: add l5d-dst-canonical to requests with ServiceProfiles (#2383)
PR #2250 removed the `l5d-dst-canonical` header from ServiceProfile requests. This header is used by the inbound proxy for telemetry purposes, so removing it and not putting it back broke ServiceProfile route metrics. This commit adds a layer for setting this header to the service profile route stack. We can also add the header for non-ServiceProfile requests if that's desirable...I'll have to look into whether it is. This commit should, at least, fix the existing ServiceProfile route metrics. Fixes #10521
1 parent d9fde0a commit cef2ba9

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

linkerd/app/outbound/src/http/logical.rs

-5
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,6 @@ enum RouterParams<T: Clone + Debug + Eq + Hash> {
6868
}
6969

7070
// Only applies to requests with profiles.
71-
//
72-
// TODO Add l5d-dst-canonical header to requests.
73-
//
74-
// TODO(ver) move this into the endpoint stack so that we can only
75-
// set this on meshed connections.
7671
#[derive(Clone, Debug)]
7772
struct CanonicalDstHeader(NameAddr);
7873

linkerd/app/outbound/src/http/logical/profile.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::{
22
super::{concrete, retry},
3-
Concrete, NoRoute,
3+
CanonicalDstHeader, Concrete, NoRoute,
44
};
55
use crate::{policy, BackendRef, ParentRef, UNKNOWN_META};
66
use linkerd_app_core::{
@@ -313,6 +313,18 @@ impl<T> RouteParams<T> {
313313
.http_profile_route
314314
.to_layer::<classify::Response, _, RouteParams<T>>(),
315315
)
316+
// Add l5d-dst-canonical header to requests.
317+
//
318+
// TODO(ver) move this into the endpoint stack so that we can
319+
// only set this on meshed connections.
320+
.push(
321+
http::NewHeaderFromTarget::<CanonicalDstHeader, _, _>::layer_via(
322+
|rp: &Self| {
323+
let LogicalAddr(addr) = rp.addr.clone();
324+
CanonicalDstHeader(addr)
325+
},
326+
),
327+
)
316328
// Sets the per-route response classifier as a request
317329
// extension.
318330
.push(classify::NewClassify::layer())

0 commit comments

Comments
 (0)