Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Defines the Tracing API.
The MonadTrace
class defines the "public API" of this component.
Synopsis
- class Monad m => MonadTrace m where
- newTraceWith :: TraceContext -> SamplingPolicy -> Text -> m a -> m a
- newSpanWith :: SpanId -> Text -> m a -> m a
- currentContext :: m (Maybe TraceContext)
- attachMetadata :: TraceMetadata -> m ()
- newTrace :: (MonadIO m, MonadTrace m) => SamplingPolicy -> Text -> m a -> m a
- newSpan :: (MonadIO m, MonadTrace m) => Text -> m a -> m a
Documentation
class Monad m => MonadTrace m where Source #
newTraceWith :: TraceContext -> SamplingPolicy -> Text -> m a -> m a Source #
Trace the execution of a block of code, attaching a human-readable name. This starts a new trace and its corresponding root span, to which subsequent spans will be attached.
newSpanWith :: SpanId -> Text -> m a -> m a Source #
Starts a new span within the current trace. No-op if there's no current trace.
TODO: we could rewrite this to start a new trace if there isn't one, using the default reporter and policy? This would guarantee that no span is ever lost, but would also risk reporting undesired spans.
currentContext :: m (Maybe TraceContext) Source #
Ask for the current tracing context, so that we can provide it to any
downstream services, e.g. in HTTP headers. Returns Nothing
if we're not
currently tracing anything.
attachMetadata :: TraceMetadata -> m () Source #
Log some arbitrary metadata to be attached to the current span, if any.
Instances
newTrace :: (MonadIO m, MonadTrace m) => SamplingPolicy -> Text -> m a -> m a Source #
Create a new trace using a randomly-generated context.