| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Instrument.Worker
Synopsis
- initWorkerCSV :: ConnectInfo -> FilePath -> Int -> AggProcessConfig -> IO ()
- initWorkerCSV' :: FilePath -> AggProcessConfig -> IO AggProcess
- initWorkerGraphite :: ConnectInfo -> Int -> HostName -> Int -> AggProcessConfig -> IO ()
- initWorkerGraphite' :: HostName -> Int -> AggProcessConfig -> IO AggProcess
- work :: Connection -> Int -> AggProcess -> IO ()
- initWorker :: String -> ConnectInfo -> Int -> AggProcess -> IO ()
- data AggProcess = AggProcess {
- apConfig :: AggProcessConfig
- apProc :: Aggregated -> Redis ()
- data AggProcessConfig = AggProcessConfig {
- metricQuantiles :: MetricName -> Set Quantile
- standardQuantiles :: MetricName -> Set Quantile
- noQuantiles :: MetricName -> Set Quantile
- quantileMap :: Map MetricName (Set Quantile) -> Set Quantile -> MetricName -> Set Quantile
- defAggProcessConfig :: AggProcessConfig
- expandDims :: forall packets. (Monoid packets, Eq packets) => Map Dimensions packets -> Map Dimensions packets
Documentation
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
Arguments
| :: FilePath | Target file name |
| -> AggProcessConfig | |
| -> IO AggProcess |
Create an AggProcess that dumps to CSV. Use this to compose with other AggProcesses
Arguments
| :: ConnectInfo | Redis connection |
| -> Int | Aggregation period / flush interval in seconds |
| -> HostName | Graphite host |
| -> Int | Graphite port |
| -> AggProcessConfig | |
| -> IO () |
Initialize a Graphite backend
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 | |
Fields
| |
Instances
| Monoid AggProcess Source # | |
Defined in Instrument.Worker Methods mempty :: AggProcess # mappend :: AggProcess -> AggProcess -> AggProcess # mconcat :: [AggProcess] -> AggProcess # | |
| Semigroup AggProcess Source # | |
Defined in Instrument.Worker Methods (<>) :: AggProcess -> AggProcess -> AggProcess # sconcat :: NonEmpty AggProcess -> AggProcess # stimes :: Integral b => b -> AggProcess -> 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
| |
Instances
| Monoid AggProcessConfig Source # | |
Defined in Instrument.Worker Methods mappend :: AggProcessConfig -> AggProcessConfig -> AggProcessConfig # mconcat :: [AggProcessConfig] -> AggProcessConfig # | |
| Semigroup AggProcessConfig Source # | |
Defined in Instrument.Worker Methods (<>) :: AggProcessConfig -> AggProcessConfig -> AggProcessConfig # sconcat :: NonEmpty AggProcessConfig -> AggProcessConfig # stimes :: Integral b => b -> AggProcessConfig -> AggProcessConfig # | |
| Default AggProcessConfig Source # | |
Defined in Instrument.Worker Methods def :: AggProcessConfig # | |
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.
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 }