-
Notifications
You must be signed in to change notification settings - Fork 7
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
Implement trace propagation #49
Conversation
@@ -331,10 +333,7 @@ where | |||
}); | |||
|
|||
router | |||
.layer( | |||
TraceLayer::new_for_http() | |||
.make_span_with(DefaultMakeSpan::default().level(Level::INFO)), |
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.
Removing this make_span_with
means we default to the default TraceLayer
implementation, which makes all error responses into error traces rather than always INFO
, solving #43
Info: https://docs.rs/tower-http/latest/tower_http/trace/struct.TraceLayer.html#method.new_for_http
pub struct PropagateParentTraces; | ||
|
||
impl<B> MakeSpan<B> for PropagateParentTraces { | ||
fn make_span(&mut self, req: &Request<B>) -> Span { |
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.
This grabs the W3 trace header (ie, traceheader
and tracestate
) and adds them to the context of any spans we create, meaning we can follow between services.
@@ -0,0 +1,23 @@ | |||
# re-build on code changes, and run the reference agent each time a build is |
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.
A few quality-of-life just
commands. Happy to move these into a separate PR if needed.
Just realised there is already an implementation in |
Closing in favour of #51 |
This PR implements trace propagation, adds a
MakeSpan
trait that grab anytraceparent
andtracestate
headers, and injecting them into span context. The result is that requests fromv3-engine
show up in NDC agents as follows: