ekg-statsd- Push metrics to statsd

Safe HaskellNone




This module lets you periodically flush metrics to a statsd backend. Example usage:

main = do
    store <- newStore
    forkStatsd defaultStatsdOptions store

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.


The statsd syncer

data Statsd Source #

A handle that can be used to control the statsd sync thread. Created by forkStatsd.

statsdFlush :: Statsd -> IO () Source #

Flush a sample to the statsd server

Since: ekg-statsd-

statsdThreadId :: Statsd -> ThreadId Source #

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

forkStatsd Source #


:: StatsdOptions


-> Store

Metric store

-> IO Statsd

Statsd sync handle

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

data StatsdOptions Source #

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




  • host :: !Text

    Server hostname or IP address

  • port :: !Int

    Server port

  • 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.

defaultStatsdOptions :: StatsdOptions Source #


  • host = ""
  • port = 8125
  • flushInterval = 1000
  • debug = False