Skip to content

tracing: in_current_span correct? #12

@xd009642

Description

@xd009642

Is it necessary to have your root span instrumenting all the tasks you spawn directly?
Because you're going to end up with a situation where you see the same span active in multiple places at the same time (assuming multi-threaded tokio runtime).
Which could be confusing.
You could instead instrument with a new span that has the root span as its parent.

so all uses of in_current_span might be incorrect? But if so how to fix it. I've always utilised it because it makes the parent/child relationships of spans show up correctly and I don't get detached root spans. I did give a try to .instrument(info_span!("name")) as an alternative but with the client receiver I ended up with a disconnected root span 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions