-
Notifications
You must be signed in to change notification settings - Fork 729
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
"Tried to clone Id(1), but no span exists with that ID" when setting parent span #688
Comments
Hmm, thanks for reporting this, that's definitely not great. We should look into potential API changes to stop this from happening. |
I've re-opened this issue because I think it's an ergonomic papercut and it'd be useful to track this. |
Just ran into this converting a bunch of code I maintain to use tracing. |
Yeah, we need to fix this. Unfortunately, I think it's going to need to wait until the next API breaking change. |
This may help give the user a hint to start debugging this. See tokio-rs#688 for further details on this issue.
(Not a real issue, just leaving this here to help future searchers.)
The docs tell you to explicitly set a parent span like this:
And this works. However, if you forget to borrow
span1
and do this......it will compile fine, but panic at runtime. 😞 It's clear what's going on here -
span1
is converted into its ID, but in the process it's dropped and the ID is deregistered from the subscriber. Still, my brain is used to getting a compile-time errors when I miss an&
and it took me a while to spot the mistake - so I thought I'd leave this here in hopes of helping the people of the future.The text was updated successfully, but these errors were encountered: