Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module provides convenience functionality to debug traces locally. For production use, prefer alternatives, e.g. Monitor.Tracing.Zipkin.
Synopsis
- collectSpanSamples :: (MonadIO m, MonadBaseControl IO m) => TraceT m a -> m (a, [Sample])
Documentation
collectSpanSamples :: (MonadIO m, MonadBaseControl IO m) => TraceT m a -> m (a, [Sample]) Source #
Runs a TraceT
action, returning any collected samples alongside its output. The samples are
sorted chronologically by completion time (e.g. the head is the first span to complete).
Spans which start before the action returns are guaranteed to be collected, even if they complete
after (in this case collection will block until their completion). More precisely,
collectSpanSamples
will return the first time there are no pending spans after the action is
done. For example:
collectSpanSamples $ rootSpan alwaysSampled "parent" $ do forkIO $ childSpan "child" $ threadDelay 2000000 -- Asynchronous 2 second child span. threadDelay 1000000 -- Returns after one second, but the child span will still be sampled.