tracing-control-0.0.7.3: Distributed tracing
Safe HaskellNone
LanguageHaskell2010

Monitor.Tracing.Local

Description

This module provides convenience functionality to debug traces locally. For production use, prefer alternatives, e.g. Monitor.Tracing.Zipkin.

Synopsis

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.