ekg-push-0.0.2: Small framework to push metric deltas to a broadcast channel.

Safe HaskellNone
LanguageHaskell2010

System.Remote.Monitoring.Push

Description

This library lets you push metric samples to a broadcast channel. Consumers can then persist the metrics samples as they wish.

Example usage:

main = do
    store <- newStore
    push <- forkPush defaultPushOptions store
    ch <- subscribe push
    sample <- consume ch
    putStrLn $ show sample

You probably want to include some of the predefined metrics defined in the ekg-core package, by calling e.g. the registerGcStats function defined in that package.

Synopsis

Documentation

data Push Source

A handle that can be used to control the push sync thread. Created by forkPush.

data PushChan Source

A new PushChan is created on every call to subscribe. This is essentially a dupChan of our main channel (mainCh).

data PushOptions Source

Options to control how to connect to the push server and how often to flush metrics. The flush interval should be shorter than the flush interval push itself uses to flush data to its backends.

Constructors

PushOptions 

Fields

flushInterval :: !Int

Data push interval, in ms.

debug :: !Bool

Print debug output to stderr.

prefix :: !Text

Prefix to add to all metric names.

suffix :: !Text

Suffix to add to all metric names. This is particularly useful for sending per host stats by settings this value to: takeWhile (/= '.') <$> getHostName, using getHostName from the Network.BSD module in the network package.

pushThreadId :: Push -> ThreadId Source

The thread ID of the push sync thread. You can stop the sync by killing this thread (i.e. by throwing it an asynchronous exception.)

forkPush Source

Arguments

:: PushOptions

Options

-> Store

Metric store

-> IO Push

Push sync handle

Create a thread that periodically flushes the metrics in the store to push.

defaultPushOptions :: PushOptions Source

Defaults:

  • flushInterval = 1000
  • debug = False

subscribe :: Push -> IO PushChan Source

Subscribe to the push broadcast channel.

consume :: PushChan -> IO Sample Source

Consume a Metrics.Sample message from a subscribed channel.