| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Runtime.Telemetry.ExportFailure.Internal
Contents
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
- data ThrottleState = ThrottleState {}
- data ThrottleEmit
- initialThrottle :: ThrottleState
- throttleStep :: NominalDiffTime -> UTCTime -> ThrottleState -> (ThrottleState, ThrottleEmit)
- data ExportFailureSink
- newExportFailureSink :: IO UTCTime -> (Severity -> Text -> IO ()) -> IO ExportFailureSink
- exportFailureSink :: LogEnv -> IO ExportFailureSink
- observeExportResult :: ExportFailureSink -> Text -> ExportResult -> IO ()
- observeFlushFault :: ExportFailureSink -> SomeException -> IO ()
- installExportErrorHandler :: ExportFailureSink -> IO ()
The throttle (pure core)
data ThrottleState Source #
The throttle's state, exposed so a test steps the throttle without a wall clock.
Constructors
| ThrottleState | |
Fields
| |
Instances
| Show ThrottleState Source # | |
Defined in Ecluse.Runtime.Telemetry.ExportFailure.Internal Methods showsPrec :: Int -> ThrottleState -> ShowS # show :: ThrottleState -> String # showList :: [ThrottleState] -> ShowS # | |
| Eq ThrottleState Source # | |
Defined in Ecluse.Runtime.Telemetry.ExportFailure.Internal Methods (==) :: ThrottleState -> ThrottleState -> Bool # (/=) :: ThrottleState -> ThrottleState -> Bool # | |
data ThrottleEmit Source #
What throttleStep decided to do with an export error.
Constructors
| EmitFirst | The first error: surface it plainly. |
| EmitHeartbeat Int | The window elapsed: surface a heartbeat with the count of errors since the last surfaced one, this one included. |
| EmitSuppress | Within the window: suppress and count. |
Instances
| Show ThrottleEmit Source # | |
Defined in Ecluse.Runtime.Telemetry.ExportFailure.Internal Methods showsPrec :: Int -> ThrottleEmit -> ShowS # show :: ThrottleEmit -> String # showList :: [ThrottleEmit] -> ShowS # | |
| Eq ThrottleEmit Source # | |
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, with a heartbeat due once interval has passed since the last surfaced error.
Routing
data ExportFailureSink Source #
One throttle and one katip target that every export-failure feed shares.
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 #
Route a failed export from the signal exporter through the sink. The exporter's request holds every collector header, so the error renders through displayFaultT.
observeFlushFault :: ExportFailureSink -> SomeException -> IO () Source #
Route a metric series the batching flush dropped because its replay into the SDK threw.
installExportErrorHandler :: ExportFailureSink -> IO () Source #
Install a process-global handler that forwards the SDK's own diagnostic text verbatim. Failed exports reach the sink separately, through observeExportResult.