Skip to content
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

Bug in Tracing instrumentation? #386

Open
QnnOkabayashi opened this issue Mar 23, 2022 · 1 comment
Open

Bug in Tracing instrumentation? #386

QnnOkabayashi opened this issue Mar 23, 2022 · 1 comment
Labels
bug Something is borken

Comments

@QnnOkabayashi
Copy link

I'm currently authoring a tracing-forest, a Subscriber that performs diagnostics on trace data. We ran into an issue where isahc generates trace data where the entered duration of a parent span is shorter than the entered duration of its children. I've outlined the problem further in this issue. I think I've narrowed down the culprit to these lines:

isahc/src/handler.rs

Lines 403 to 404 in 79338ab

let span = tracing::trace_span!(parent: &self.span, "header");
let _enter = span.enter();

Here, the parent is passed in to the child and the child is entered, but the parent is not, causing the children to accumulate time while the parent idles. Is there a reason for not entering the parent span, or is this a bug? If it is intended, what is the motivation for it?

I would guess that the fix would look something like this, where the parent span is entered before the child:

let span = tracing::trace_span!(parent: &self.span, "header");
let _enter = self.span.enter(); // parent enters before the child
let _enter = span.enter();
@sagebind
Copy link
Owner

sagebind commented Apr 6, 2022

Thanks for filing an issue! I'm not actually sure if this is being done by Isahc intentionally or not but is worth digging into. At first guess I suppose maybe I had assumed that entering a child span would cause the parent to be considered "entered" automatically, but maybe that assumption was incorrect. Either way this probably needs fixed.

@sagebind sagebind added the bug Something is borken label Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is borken
Projects
None yet
Development

No branches or pull requests

2 participants