instrument-0.6.1.0: Easy stats/metrics instrumentation for Haskell programs
Safe HaskellSafe-Inferred
LanguageHaskell2010

Instrument.Worker

Synopsis

Documentation

initWorkerCSV Source #

Arguments

:: ConnectInfo 
-> FilePath

Target file name

-> Int

Aggregation period / flush interval in seconds

-> AggProcessConfig 
-> IO () 

A CSV backend to store aggregation results in a CSV

initWorkerCSV' Source #

Arguments

:: FilePath

Target file name

-> AggProcessConfig 
-> IO AggProcess 

Create an AggProcess that dumps to CSV. Use this to compose with other AggProcesses

initWorkerGraphite Source #

Arguments

:: ConnectInfo

Redis connection

-> Int

Aggregation period / flush interval in seconds

-> HostName

Graphite host

-> Int

Graphite port

-> AggProcessConfig 
-> IO () 

Initialize a Graphite backend

initWorkerGraphite' Source #

Arguments

:: HostName

Graphite host

-> Int

Graphite port

-> AggProcessConfig 
-> IO AggProcess 

Crete an AggProcess that dumps to graphite. Use this to compose with other AggProcesses

work :: Connection -> Int -> AggProcess -> IO () Source #

Go over all pending stats buffers in redis.

initWorker :: String -> ConnectInfo -> Int -> AggProcess -> IO () Source #

Generic utility for making worker backends. Will retry indefinitely with exponential backoff.

data AggProcess Source #

A function that does something with the aggregation results. Can implement multiple backends simply using this. Note that Semigroup and Monoid instances are provided for defaulting and combining agg processes.

Constructors

AggProcess 

Configuring agg processes

data AggProcessConfig Source #

General configuration for agg processes. Defaulted with def, defAggProcessConfig, and mempty. Configurations can be combined with (<>) from Monoid or Semigroup.

Constructors

AggProcessConfig 

Fields

standardQuantiles :: MetricName -> Set Quantile Source #

This is usually a good, comprehensive default. Produces quantiles 10,20,30,40,50,60,70,80,90,99. *Note:* for some backends like cloudwatch, each quantile produces an additional metric, so you should probably consider using something more limited than this.

noQuantiles :: MetricName -> Set Quantile Source #

Regardless of metric, produce no quantiles.

quantileMap Source #

Arguments

:: Map MetricName (Set Quantile) 
-> Set Quantile

What to return on miss

-> MetricName -> Set Quantile 

If you have a fixed set of metric names, this is often a convenient way to express quantiles-per-metric.

Exported for testing

expandDims :: forall packets. (Monoid packets, Eq packets) => Map Dimensions packets -> Map Dimensions packets Source #

Take a map of packets by dimensions and *add* aggregations of the existing dims that isolate each distinct dimension/dimensionvalue pair + one more entry with an empty dimension set that aggregates the whole thing. worked example:

Given: { {d1=>d1v1,d2=>d2v1} => p1 , {d1=>d1v1,d2=>d2v2} => p2 } Produces: { {d1=>d1v1,d2=>d2v1} => p1 , {d1=>d1v1,d2=>d2v2} => p2 , {d1=>d1v1} => p1 + p2 , {d2=>d2v1} => p1 , {d2=>d2v2} => p2 , {} => p1 + p2 }