kim / opentracing

OpenTracing (https://opentracing.io) for Haskell
Apache License 2.0
40 stars 12 forks source link

Allow for all possible kinds of references #4

Closed kim closed 6 years ago

kim commented 6 years ago

This entails:

isovector commented 6 years ago

I'm not entirely sure what the value of FollowsFrom is, but besides that everything looks good!

kim commented 6 years ago

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.