ekg-log-0.1.0.4: Push metrics to a log file.

Safe HaskellNone
LanguageHaskell2010

System.Local.Monitoring.Log

Contents

Description

This module lets you periodically flush metrics to a log file that automatically rotates itself.

main = do
    store <- newStore
    forkEkgLog defaultLogOptions 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.

Synopsis

The log syncer

data Log Source

A handle that can be used to control the log sync thread. Created by forkEkgLog.

logThreadId :: Log -> ThreadId Source

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

forkEkgLog Source

Arguments

:: LogOptions

Options

-> Metrics.Store

Metric store

-> IO Log

Log sync handle

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

data LogOptions Source

Options to control whate log file to append to, when to rotate, and how often to flush metrics. The flush interval should be shorter than the flush interval.

Constructors

LogOptions 

Fields

logfile :: !FilePath

Server hostname or IP address

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

defaultLogOptions :: LogOptions Source

Defaults:

  • logfile = "./ekg.log"
  • flushInterval = 5000
  • debug = False