Safe Haskell | None |
---|---|
Language | Haskell2010 |
Control.Monad.Trace.Class
Description
The MonadTrace
class
Synopsis
- class Monad m => MonadTrace m where
- trace :: Builder -> m a -> m a
- activeSpan :: m (Maybe Span)
- addSpanEntry :: Key -> Value -> m ()
- data Builder = Builder {
- builderName :: !Name
- builderTraceID :: !(Maybe TraceID)
- builderSpanID :: !(Maybe SpanID)
- builderReferences :: !(Set Reference)
- builderTags :: !(Map Key Value)
- builderBaggages :: !(Map Key ByteString)
- type Name = Text
- data SpanID
- data TraceID
- data Reference
- = ChildOf !SpanID
- | FollowsFrom !Context
- builder :: Name -> Builder
- data Span = Span {
- spanName :: !Name
- spanContext :: !Context
- spanReferences :: !(Set Reference)
- data Context = Context {
- contextTraceID :: !TraceID
- contextSpanID :: !SpanID
- contextBaggages :: !(Map Key ByteString)
- type Key = Text
- data Value
- tagDoubleValue :: Double -> Value
- tagInt64Value :: Integral a => a -> Value
- tagTextValue :: Text -> Value
- logValue :: ToJSON a => a -> Value
- logValueAt :: ToJSON a => POSIXTime -> a -> Value
Documentation
class Monad m => MonadTrace m where Source #
A monad capable of generating traces.
There are currently two instances of this monad:
Minimal complete definition
Methods
trace :: Builder -> m a -> m a Source #
Trace an action, wrapping it inside a new span.
activeSpan :: m (Maybe Span) Source #
Extracts the currently active span, or Nothing
if the action is not being traced.
activeSpan :: (MonadTrace n, MonadTrans t, m ~ t n) => m (Maybe Span) Source #
Extracts the currently active span, or Nothing
if the action is not being traced.
addSpanEntry :: Key -> Value -> m () Source #
Adds information to the active span, if present.
addSpanEntry :: (MonadTrace n, MonadTrans t, m ~ t n) => Key -> Value -> m () Source #
Adds information to the active span, if present.
Instances
MonadTrace Identity Source # | |
MonadUnliftIO m => MonadTrace (TraceT m) Source # | |
(Monad m, MonadTrace m) => MonadTrace (ExceptT e m) Source # | |
(Monad m, MonadTrace m) => MonadTrace (StateT s m) Source # | |
(Monad m, MonadTrace m) => MonadTrace (StateT s m) Source # | |
(Monad m, MonadTrace m, Monoid w) => MonadTrace (WriterT w m) Source # | |
(Monad m, MonadTrace m, Monoid w) => MonadTrace (WriterT w m) Source # | |
(Monad m, MonadTrace m) => MonadTrace (ReaderT r m) Source # | |
(Monad m, MonadTrace m, Monoid w) => MonadTrace (RWST r w s m) Source # | |
(Monad m, MonadTrace m, Monoid w) => MonadTrace (RWST r w s m) Source # | |
A trace builder.
Note that Builder
has an IsString
instance, producing a span with the given string as name,
no additional references, tags, or baggages. This allows convenient creation of spans via the
OverloadedStrings
pragma.
Constructors
Builder | |
Fields
|
A 64-bit span identifier.
A 128-bit trace identifier.
A relationship between spans.
There are currently two types of references, both of which model direct causal relationships between a child and a parent. More background on references is available in the opentracing specification: https://github.com/opentracing/specification/blob/master/specification.md.
Constructors
ChildOf !SpanID |
|
FollowsFrom !Context | If the parent does not depend on the child, we use a |
Instances
Eq Reference Source # | |
Ord Reference Source # | |
Show Reference Source # | |
builder :: Name -> Builder Source #
Returns a Builder
with the given input as name and all other fields empty.
A part of a trace.
Constructors
Span | |
Fields
|
A fully qualified span identifier, containing both the ID of the trace the span belongs to and
the span's ID. Span contexts can be exported (resp. imported) via their toJSON
(resp.
fromJSON
) instance.
Constructors
Context | |
Fields
|
The type of annotations' keys.
Keys starting with double underscores are reserved and should not be used.
tagDoubleValue :: Double -> Value Source #
Generates a tag value from a double.
tagInt64Value :: Integral a => a -> Value Source #
Generates a 64-bit integer tag value from any integer.
tagTextValue :: Text -> Value Source #
Generates a Unicode text tag value.