-
this code can not nest
|
Beta Was this translation helpful? Give feedback.
Answered by
holicc
Jul 30, 2024
Replies: 2 comments 3 replies
-
How about the following code? {
let test_span = tracing::info_span!("TEST");
// test_span.set_parent(parent_cx);
let _enter = test_span.enter();
tracing::info!("test span");
} |
Beta Was this translation helpful? Give feedback.
3 replies
-
Oh, I know why the spans are not nested. It's because I created a span first and did not set its parent, so I got |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
holicc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oh, I know why the spans are not nested. It's because I created a span first and did not set its parent, so I got
root_span <- span (with new context) <- test_span
. I broke the hierarchy ofRegister
. So I created aroot_span
with context to fix the problem.