Skip to content

Parent/child relationships #3150

Answered by mladedav
soehrl asked this question in Q&A
Nov 21, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

You do understand everything correctly.

In most scenarios you enter a span inside its parent so this shouldn't be an issue.

Setting the parent to the current span when entered would not work because you might enter it multiple times in different contexts. Setting it on the first enter would be more confusing than setting it on creation and would be weird with explicit parents.

I can imagine the example you created to happen where span A is a producer that creates some task, instruments it with span B which is set as the producer span's child and without running that task, it sends it to another thread where a worker thread runs in span C and executes the task, thus entering the span there…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@soehrl
Comment options

Answer selected by soehrl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants