Closed kim closed 6 years ago
I'm not entirely sure what the value of FollowsFrom is, but besides that everything looks good!
I'm not entirely sure what the value of FollowsFrom is
I think it's when you don't want to wait for the parent span to complete only after all children have completed (see also: https://github.com/opentracing/opentracing-go/blob/master/tracer.go#L183-L207). Contrived example:
users <- traced (spanOpts "getUsers" mempty) $ const getUsers
async $ traced__ (spanOpts "cacheUserIds" (followsFrom (tracedSpan users))) $ const cacheUserIds (tracedResult users)
doSomethingElseWith (tracedResult users)
If the cache insert happens as a child, the users
result is only available after that action has completed (and includes it's timing information).
Obviously, nothing prevents you at the moment to run children asynchronously and don't wait for their completion inside the traced
block. I think the resulting trace would look the same.
This entails:
ActiveSpan
is mutable, thus derefencing it as aChildOf
reference must occur at the end of it's lifetime (ie. we have to carry it around as a mutable reference)traced
returns theFinishedSpan
along with the result of the traced action, such that it can be used as aFollowsFrom
reference in subsequenttraced
callsReference
s may be used as obtained from the propagation carrier