| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Arbiter.Core.Trace
Description
W3C trace context carried on enqueued jobs, and the producer and consumer spans around them. The OpenTelemetry API is inert until an SDK installs a provider.
Synopsis
- data TraceContext = TraceContext {
- traceparent :: Text
- tracestate :: Maybe Text
- stampTraceContext :: Maybe TraceContext -> JobWrite payload -> JobWrite payload
- data Tracer
- resolveTracer :: MonadIO m => m (Maybe Tracer)
- currentTraceContext :: IO (Maybe TraceContext)
- withPublishSpan :: (HasKind payload, MonadUnliftIO m) => TableName -> [JobWrite payload] -> m a -> m a
- data ConsumeSpan
- data ConsumeShape
- consumeSpanFor :: TableName -> ConsumeShape -> ConsumeSpan
- withConsumeSpan :: MonadUnliftIO m => Maybe Tracer -> ConsumeSpan -> NonEmpty (JobRead payload) -> m a -> m a
- withJobParent :: MonadUnliftIO m => JobRead payload -> m a -> m a
- capturingContext :: MonadUnliftIO m => m (m a -> m a)
- markSpanError :: MonadIO m => Text -> m ()
- recordJobFailure :: MonadIO m => JobRead payload -> Text -> m ()
- recordJobCancelled :: MonadIO m => JobRead payload -> Text -> m ()
Job trace context
Source #data TraceContext
A job's W3C trace context.
Constructors
| TraceContext | |
Fields
| |
Instances
Source #stampTraceContext :: Maybe TraceContext -> JobWrite payload -> JobWrite payload
Fill a job's trace context. A job that carries one of its own keeps it.
Tracer
Creates and manages Spans for a specific instrumentation scope.
Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#tracer
Since: hs-opentelemetry-api-0.0.1.0
Source #resolveTracer :: MonadIO m => m (Maybe Tracer)
Resolve the arbiter tracer once, or Nothing when nothing is collecting.
Producer
Source #currentTraceContext :: IO (Maybe TraceContext)
The ambient span's trace context, or Nothing when no span is active. Read from
the thread-local context of the enqueuing thread.
Source #withPublishSpan :: (HasKind payload, MonadUnliftIO m) => TableName -> [JobWrite payload] -> m a -> m a
Run an action inside a publish <queue> producer span over n jobs.
Consumer
Source #data ConsumeSpan
Queue attributes for consumer spans. Resolve them one time for each pool and reuse them for claimed jobs.
Source #data ConsumeShape
What one consumer span covers.
Instances
| Eq ConsumeShape Source # | |
Defined in Arbiter.Core.Trace | |
| Show ConsumeShape Source # | |
Defined in Arbiter.Core.Trace Methods #showsPrec :: Int -> ConsumeShape -> ShowS #show :: ConsumeShape -> String #showList :: [ConsumeShape] -> ShowS | |
Source #consumeSpanFor :: TableName -> ConsumeShape -> ConsumeSpan
The consumer-span shape for a queue.
Source #withConsumeSpan :: MonadUnliftIO m => Maybe Tracer -> ConsumeSpan -> NonEmpty (JobRead payload) -> m a -> m a
Run a job handler inside a process <queue> consumer span linked to its producer.
Source #withJobParent :: MonadUnliftIO m => JobRead payload -> m a -> m a
Run an action with the job's stored trace context as the ambient parent.
Source #capturingContext :: MonadUnliftIO m => m (m a -> m a)
Capture the caller context for an action on a child thread. Return the unchanged action if the context has no span.
Span enrichment
Reach for hs-opentelemetry-api directly for custom spans and attributes.
Source #markSpanError :: MonadIO m => Text -> m ()
Mark the currently active span failed.