ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Telemetry.Span

Description

The domain-span tracing ports, and the bracket Pilot opens its own spans through.

The serve path, the mirror worker, and the advisory sync task reach their hand-added spans through a port: bracket operations as a record, parametric in the bracketed action's result and naming no OpenTelemetry tracer, so the application supplies the OTel-backed implementations and a test a pass-through double. Pilot's passes run outside a request and hold the TracerProvider themselves, so they bracket through withOptionalSpan instead. Both consumers create their tracer under ecluseScope.

Synopsis

The serve-path tracing port

data TracingPort Source #

The domain-span tracing port: bracket operations over a backend whose closure captures its tracer. The implementation is inert when tracing is off, so a call site brackets unconditionally.

Constructors

TracingPort 

Fields

The worker tracing port

newtype WorkerTracingPort Source #

The mirror worker's domain-span tracing port: the worker analogue of TracingPort. The implementation is inert when tracing is off, so the worker brackets unconditionally.

Constructors

WorkerTracingPort 

Fields

data JobSpanOutcome Source #

The outcome projection a caller supplies for the mirror-job span. It is its own record so the tracing port does not depend on the worker loop.

Constructors

JobSpanOutcome 

Fields

The advisory sync tracing port

newtype AdvisorySyncTracingPort Source #

One span per advisory sync attempt. It carries the same AdvisorySyncResult that labels the attempt metrics, so a trace and a series join on one vocabulary.

Constructors

AdvisorySyncTracingPort 

Fields

Bracketing a span against an optional tracer

ecluseScope :: IsString s => s Source #

The instrumentation scope the hand-added spans and the WAI meter are created under, so the signals are attributed to Écluse rather than to a third-party instrumentation library.

withOptionalSpan :: MonadUnliftIO m => Maybe TracerProvider -> SpanKind -> Text -> (Maybe Span -> m a) -> m a Source #

Run body against a span opened on mTracerProvider, or against Nothing when there is none, which opens no span. The span roots its own trace: no ambient context is consulted.

openOptionalSpan :: MonadIO m => Maybe TracerProvider -> SpanKind -> Text -> m (Maybe Span) Source #

The acquire half of withOptionalSpan, for a conduit pass that brackets through bracketP rather than bracket.

closeOptionalSpan :: MonadIO m => Maybe Span -> m () Source #

The release half of withOptionalSpan. Ending at the current instant, as Nothing asks.