ecluse:ecluse-runtime
Safe HaskellNone
LanguageGHC2021

Ecluse.Runtime.Telemetry.ExportFailure.Internal

Description

The throttle and the sink behind Ecluse.Runtime.Telemetry.ExportFailure, which documents the routing and re-exports the curated surface. Importing this module opts out of that stability promise, the convention text and bytestring use, so production code imports the public one.

Synopsis

The throttle (pure core)

data ThrottleState Source #

The throttle state for SDK export-error routing. Exposed so a test asserts the throttle decision without wall-clock timing.

Constructors

ThrottleState 

Fields

data ThrottleEmit Source #

What throttleStep decided to do with an export error.

Constructors

EmitFirst

The first error: surface it plainly.

EmitHeartbeat Int

The throttle window elapsed: surface a heartbeat carrying the count of errors since the last surfaced one (this one included).

EmitSuppress

Within the window: suppress and count.

initialThrottle :: ThrottleState Source #

The initial throttle state: nothing logged, nothing suppressed.

throttleStep :: NominalDiffTime -> UTCTime -> ThrottleState -> (ThrottleState, ThrottleEmit) Source #

Advance the throttle for one export error at now: the first surfaces, a heartbeat once interval has elapsed since the last surfaced error, and anything between is suppressed and counted.

Routing

data ExportFailureSink Source #

One throttle and one katip target shared by every export-failure feed. The clock and the surfacing action are injected, so a test asserts the throttle decision without wall-clock timing.

newExportFailureSink :: IO UTCTime -> (Severity -> Text -> IO ()) -> IO ExportFailureSink Source #

Build an export-failure sink over an injected clock and surfacing action.

exportFailureSink :: LogEnv -> IO ExportFailureSink Source #

The production sink: the wall clock and the composition-root LogEnv as the katip target.

observeExportResult :: ExportFailureSink -> Text -> ExportResult -> IO () Source #

Observe one exporter's ExportResult, routing a Failure through the sink. signal names the exporter (span / metric). hs-opentelemetry 1.0.0.0 drops a failed OTLP export, so only this feed reports one.

installExportErrorHandler :: ExportFailureSink -> IO () Source #

Install a process-global handler for the SDK's own diagnostic stream, forwarded verbatim. Ecluse reads none of OTEL_EXPORTER_OTLP_HEADERS, DD_API_KEY, DD_SITE, so the SDK's own text is the only leak channel.