ekg-statsd-0.2.6.0: Push metrics to statsd
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.Remote.Monitoring.Statsd

Description

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.

Note that the StatsD protocol does not allow : in metric names, so any occurrences are replaced by '_'.

Synopsis

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: 0.2.3.0

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 #

Arguments

:: StatsdOptions

Options

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

Constructors

StatsdOptions 

Fields

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

Defaults:

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