carl-ellis/skyline — pull request #2 by carl-ellis (2014-02-25 16:19:50+00:00)
Title: Algorithms with custom conditions from settings file

Allows you to define a function with initial conditions, will require the function to curry an inner function.

For example

```
def above_threshold(threshold=10):
""" In order to be able to support different failure threshold
this will return a curried function with a threshold coded inside it
"""
def f(timeseries, threshold=threshold):
""" Actual diagnostic. If larger than the threshold, flag as failed
"""
return max(timeseries) > threshold

return f
```

can be used in the custom_alerter algorithms list as:

```
CUSTOM_ANALYSERS = {
'my_service_name' : {
'metric_filter': 'my_service',
'algorithms': [
'stddev_from_average',
('over_threshold', {'threshold': 5}),
],
}
```