Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module lets you periodically flush metrics to a Graphite Carbon backend. Example usage:
main = do store <- newStore forkCarbon defaultCarbonOptions store
You probably want to include some of the predefined metrics defined
in the ekg-core
package, by calling e.g. the registerGcMetrics
function defined in that package.
- data CarbonOptions = CarbonOptions {}
- defaultCarbonOptions :: CarbonOptions
- forkCarbon :: CarbonOptions -> Store -> IO ThreadId
- forkCarbonRestart :: CarbonOptions -> Store -> (SomeException -> IO () -> IO ()) -> IO ThreadId
Documentation
data CarbonOptions Source #
Options to control how to connect to the Carbon server and how often to flush metrics. The flush interval should match the shortest retention rate of the matching retention periods, or you risk over-riding previous samples.
CarbonOptions | |
|
forkCarbon :: CarbonOptions -> Store -> IO ThreadId Source #
Create a thread that periodically flushes the metrics in Store
to
Carbon. If the thread flushing statistics throws an exception (for example, the
network connection is lost), this exception will be thrown up to the thread
that called forkCarbon
. For more control, see forkCarbonRestart
.
forkCarbonRestart :: CarbonOptions -> Store -> (SomeException -> IO () -> IO ()) -> IO ThreadId Source #
Create a thread that periodically flushes the metrics in Store
to
Carbon. If the thread flushing statistics throws an exception (for example, the
network connection is lost), the callback function will be invoked with the
exception that was thrown, and an IO
computation to restart the handler.
For example, you can use forkCarbonRestart
to log failures and restart
logging:
forkCarbonRestart defaultCarbonOptions store (\ex restart -> do hPutStrLn stderr ("ekg-carbon: " ++ show ex) restart)