-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
propagate spans to tasks spawned by Hyper (#550)
Previously, in the `futures` 0.1 version of the proxy, we provided `hyper` with a custom executor to propagate `tracing` spans to tasks spawned by `hyper`. In the process of updating the proxy to `std::future`, this was removed, meaning that any tasks spawned by hyper are missing their spans. This makes events recorded by `h2` and so on hard to debug, especially when many connections are open. This branch fixes this by adding an implementation of `hyper::Executor` that propagates the current span when spawning a task. Signed-off-by: Eliza Weisman <eliza@buoyant.io>
- Loading branch information
Showing
8 changed files
with
44 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use std::future::Future; | ||
use tracing_futures::Instrument; | ||
|
||
#[derive(Clone, Debug)] | ||
pub struct Executor { | ||
_p: (), | ||
} | ||
|
||
impl Executor { | ||
#[inline] | ||
pub fn new() -> Self { | ||
Self { _p: () } | ||
} | ||
} | ||
|
||
impl<F> hyper::rt::Executor<F> for Executor | ||
where | ||
F: Future + Send + 'static, | ||
F::Output: Send + 'static, | ||
{ | ||
#[inline] | ||
fn execute(&self, f: F) { | ||
tokio::spawn(f.in_current_span()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters