arbiter-otel-0.1.0.0
arbiter-otel
Safe HaskellNone
LanguageGHC2024

Arbiter.Otel.Gauges.Cache

Description

Shared state for gauge instruments and the refresh loop.

Synopsis

Documentation

Source #data Snapshot

Values from one database scan.

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

Source #data Cached

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

Constructors

Cached 

Source #data Export

What the instruments export. Idle keeps the last reading's scan time for the staleness series. Before the first scan it has none.

Constructors

Live Cached 
Idle (Maybe Double) 

Source #live :: Export -> Maybe Cached

The scan behind an export, if it has one.

Source #lastScan :: Export -> Maybe Double

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

Source #retire :: Export -> Export

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

Source #data GaugeCache

Mutable gauge state and its registration time.

Source #data Baseline

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

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

One counter series: its instrument and attributes.

Source #newGaugeCache :: Double -> IO GaugeCache

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

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

Publish a snapshot to the observable instruments.

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

Update the result of the last database operation.

Source #retireCache :: GaugeCache -> STM ()

Stop exporting the cached snapshot.

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

What a total scanned at scannedAt adds to its series. The first reading and an already counted reading add nothing. A reset counter adds the whole total. Any other reading adds the difference.