Cue / scales

scales - Metrics for Python
Apache License 2.0
920 stars 73 forks source link

Stefan #5

Closed stfp closed 12 years ago

stfp commented 12 years ago

This adds support for regular expression in aggregations keys.

Use it by specifying a (name, regex) tuple as the key in an aggregator definition, ie:

agg = aggregation.Aggregation({
  'http_hits' : {
    ('ok', re.compile("[1-3][0-9][0-9]")): [aggregation.Sum(dataFormat=aggregation.DataFormats.DIRECT)],
    ('err', re.compile("[4-5][0-9][0-9]")):  [aggregation.Sum(dataFormat = aggregation.DataFormats.DIRECT)]
}})

This would sum successful and failed hits separately.