-
Notifications
You must be signed in to change notification settings - Fork 270
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
Update routers to support per-request backend distributions #2095
Changes from all commits
8d0d573
c1bc339
9fe1f22
f972b2b
1ad89e1
018331b
f2f7e0e
6f18cb3
b734788
9f01cde
3615bd1
0465195
b1972b7
cbc7758
a211d3e
c7922a4
6a93036
9ebb0a8
9afd8fb
9e8e0bf
671ca3e
ab86158
a72313f
35314a1
76180d1
dea82cc
2928409
3af02bf
6eaa093
259bda1
f5f2634
ae67263
33e4b02
aeeddde
890b757
f2ee2b8
508fe26
7ad21df
6d3eb56
3728bec
e74e955
190c39d
3b08665
304afcf
914aed0
01bda98
c20a0e8
f7a48af
2fd5e5d
7598421
8457392
019c2e6
17cc43f
07fd66e
7db1379
3355497
269f496
82d9c5b
2243b02
a5f953b
97da3e5
4cb9ac0
e4f0cf4
eadb2f1
e122dd0
21cbf82
e6ee9b4
b4a28d9
db90da9
554f567
dc7e82d
f2d39f2
279b952
e46e3c7
2e33e96
866d610
1215bb5
b3206e2
22b8af8
12c5777
ddff3e7
e7a96c0
e38bbb6
1d152c4
8fd5e3a
0865ae9
d840fb7
fb23e0b
fe74387
13ee98a
62287f5
8b4cf4a
d79917f
bcc054e
0205b92
15aec0c
c34b1c9
69e526f
a422568
7b09f69
2f80777
6bb0568
d54b705
075e9fe
a17c6b2
d076539
3c062ea
749b042
f4fe942
d4fb42a
42dc550
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,18 @@ use tracing::debug_span; | |
pub struct Skip; | ||
|
||
impl<N> Outbound<N> { | ||
/// Builds a `NewService` that produces services that optionally (depending | ||
/// on the target) perform HTTP protocol detection on sockets. | ||
/// | ||
/// When HTTP is detected, an HTTP service is build from the provided HTTP | ||
/// stack. In either case, the inner service is built for each connection so | ||
/// inner services must implement caching as needed. | ||
// | ||
// TODO(ver) We can be smarter about reusing inner services across | ||
// connections by moving caching into this stack... | ||
// | ||
// TODO(ver) Let discovery influence whether we assume an HTTP protocol | ||
// without deteciton. | ||
pub fn push_detect_http<T, U, NSvc, H, HSvc, I>(self, http: H) -> Outbound<svc::ArcNewTcp<T, I>> | ||
where | ||
I: io::AsyncRead + io::AsyncWrite + io::PeerAddr, | ||
|
@@ -31,6 +43,8 @@ impl<N> Outbound<N> { | |
self.map_stack(|config, rt, tcp| { | ||
let ServerConfig { h2_settings, .. } = config.proxy.server; | ||
|
||
let tcp = tcp.instrument(|_: &_| debug_span!("opaque")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: looks like the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'd rather not vary that at the span level. we have events on the parent that indicate any detection timeouts. |
||
|
||
svc::stack(http) | ||
.push_on_service( | ||
svc::layers() | ||
|
@@ -46,7 +60,14 @@ impl<N> Outbound<N> { | |
.push_on_service(svc::MapTargetLayer::new(io::EitherIo::Right)) | ||
.into_inner(), | ||
)) | ||
.push_on_service(svc::BoxService::layer()) | ||
.push_on_service( | ||
svc::layers() | ||
// `DetectService` oneshots the inner service, so we add | ||
// a loadshed to prevent leaking tasks if (for some | ||
// unexpected reason) the inner service is not ready. | ||
.push(svc::LoadShed::layer()) | ||
.push(svc::BoxService::layer()), | ||
) | ||
.check_new_service::<(Option<http::Version>, T), _>() | ||
.push_map_target(detect::allow_timeout) | ||
.push(svc::ArcNewService::layer()) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiny nit: is this indentation rustfmt-approved? it seems off to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's all rustfmt's doing.