-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Push metrics to statsd
--   
--   This library lets you push system metrics to a statsd server.
@package ekg-statsd
@version 0.2.2.0


-- | This module lets you periodically flush metrics to a statsd backend.
--   Example usage:
--   
--   <pre>
--   main = do
--       store &lt;- newStore
--       forkStatsd defaultStatsdOptions store
--   </pre>
--   
--   You probably want to include some of the predefined metrics defined in
--   the ekg-core package, by calling e.g. the <tt>registerGcStats</tt>
--   function defined in that package.
module System.Remote.Monitoring.Statsd

-- | A handle that can be used to control the statsd sync thread. Created
--   by <a>forkStatsd</a>.
data Statsd

-- | 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.)
statsdThreadId :: Statsd -> ThreadId

-- | Create a thread that periodically flushes the metrics in the store to
--   statsd.
forkStatsd :: StatsdOptions -> Store -> IO Statsd

-- | 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.
data StatsdOptions
StatsdOptions :: !Text -> !Int -> !Int -> !Bool -> !Text -> !Text -> StatsdOptions

-- | Server hostname or IP address
[host] :: StatsdOptions -> !Text

-- | Server port
[port] :: StatsdOptions -> !Int

-- | Data push interval, in ms.
[flushInterval] :: StatsdOptions -> !Int

-- | Print debug output to stderr.
[debug] :: StatsdOptions -> !Bool

-- | Prefix to add to all metric names.
[prefix] :: StatsdOptions -> !Text

-- | Suffix to add to all metric names. This is particularly useful for
--   sending per host stats by settings this value to: <tt>takeWhile (/=
--   '.') &lt;$&gt; getHostName</tt>, using <tt>getHostName</tt> from the
--   <tt>Network.BSD</tt> module in the network package.
[suffix] :: StatsdOptions -> !Text

-- | Defaults:
--   
--   <ul>
--   <li><tt>host</tt> = <tt>"127.0.0.1"</tt></li>
--   <li><tt>port</tt> = <tt>8125</tt></li>
--   <li><tt>flushInterval</tt> = <tt>1000</tt></li>
--   <li><tt>debug</tt> = <tt>False</tt></li>
--   </ul>
defaultStatsdOptions :: StatsdOptions
