ecluse:ecluse-runtime
Safe HaskellNone
LanguageGHC2021

Ecluse.Runtime.Telemetry.Batched.Internal

Description

The batch, the wrapped meters and the flush behind Ecluse.Runtime.Telemetry.Batched, which documents the batching 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 production wrapper

batchMeterProvider :: (SomeException -> IO ()) -> MeterProvider -> IO (MeterProvider, IO ()) Source #

Wrap an SDK provider so its synchronous Int64 counters, up-down counters and gauges, and its histograms, record per capability. Also returns the flusher's step: wait a second, then flush.

The batch

data Batch Source #

What the wrapped meters share: their instruments, the flushes, and the lock that orders flushes.

Constructors

Batch 

Fields

newBatch :: IO Word64 -> (SomeException -> IO ()) -> IO Batch Source #

A batch over a monotonic clock in nanoseconds, reporting each series it drops.

batchedProvider :: Batch -> MeterProvider -> IO MeterProvider Source #

Wrap a provider's meters. Its SDK must run observable callbacks before every collection, because one of them flushes, so every export, the reader's last at shutdown included, is current.

flushBatch :: Batch -> IO () Source #

Replay everything recorded so far into the SDK. Waiting for the lock may be interrupted, but the drain and replay may not, so a cancelled flush loses no record.