arbiter-otel-0.1.0.0
arbiter-otel
Safe HaskellNone
LanguageGHC2024

Arbiter.Otel.Gauges.Cache

Description

Internal to the arbiter packages. Not covered by the PVP.

Shared state for gauge instruments and the refresh loop.

Synopsis

Documentation

data SnapshotSource #

Values from one database scan.

Constructors

Snapshot 

Fields

Instances

Instances details
FromJSON Snapshot Source # 
Instance details

Defined in Arbiter.Otel.Gauges.Cache

ToJSON Snapshot Source # 
Instance details

Defined in Arbiter.Otel.Gauges.Cache

Generic Snapshot Source # 
Instance details

Defined in Arbiter.Otel.Gauges.Cache

type Rep Snapshot Source # 
Instance details

Defined in Arbiter.Otel.Gauges.Cache

data CachedSource #

A snapshot and the monotonic time at which its scan started.

Constructors

Cached 

Fields

data ExportSource #

Instrument export state. Idle retains the last scan time, if available.

Constructors

Live Cached

Export the readings of this scan.

Idle (Maybe Double)

Export nothing. Keep the last scan time, if any.

live :: Export -> Maybe CachedSource #

The scan behind an export, if it has one.

lastScan :: Export -> Maybe DoubleSource #

When the export was last scanned, if it ever was.

retire :: Export -> ExportSource #

Stop exporting readings, keeping when the last one was scanned.

data GaugeCacheSource #

Mutable gauge state and its registration time.

Constructors

GaugeCache 

Fields

newGaugeCache :: Double -> IO GaugeCacheSource #

Create an empty gauge cache for a registration starting at now.

publishSnapshot :: GaugeCache -> Cached -> STM ()Source #

Publish a snapshot to the observable instruments.

setReachable :: GaugeCache -> Bool -> STM ()Source #

Record whether the last gauge scan reached the database.

retireCache :: GaugeCache -> STM ()Source #

Stop exporting the cached snapshot.

type SeriesKey = (Text, [(Text, Text)])Source #

One counter series: its instrument and attributes.

data BaselineSource #

The scan a counter series was last counted from, and the total it stood at.

riseSince :: SeriesKey -> Double -> Double -> HashMap SeriesKey Baseline -> (HashMap SeriesKey Baseline, Double)Source #

Arguments

:: SeriesKey 
-> Double

Monotonic time the total was scanned at.

-> Double

The scanned total.

-> HashMap SeriesKey Baseline 
-> (HashMap SeriesKey Baseline, Double) 

What a scanned total adds to its series.