Safe Haskell | None |
---|---|
Language | Haskell2010 |
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.
- data Push
- data PushChan
- data PushOptions = PushOptions {}
- pushThreadId :: Push -> ThreadId
- forkPush :: PushOptions -> Store -> IO Push
- defaultPushOptions :: PushOptions
- subscribe :: Push -> IO PushChan
- consume :: PushChan -> IO Sample
Documentation
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.
PushOptions | |
|
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.)
:: 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