nodejitsu/godot — pull request #40 by indexzero (2013-03-13 04:21:12+00:00)
Title: Add "meta" property to event data and associated Reactors

This adds a relatively simple new field to all events:

> { ... meta: "Freeform set of key:value pairs e.g. { 'ewma': 12345 }", ... }

I came across this problem when working on a relatively simple use-case:

> Emit data when the metric is one (or more) standard deviations above
> (or below) the EWMA of the same metric.

To make this decision you need to know the `metric`, the `ewma` and the `stdDev`. Before adding `meta` I was having the `ewma` stream simply attach tags:

``` js
{
// ...
"tags": ["ewma:12345.67", "stdDev:234.5"],
// ...
}
```

This is all well and good, but it felt wrong to be serializing and deserializing these values later on in the stream processing pipeline. With `meta` I end up with:

``` js
{
// ...
"meta": {
"ewma": 12345.67,
"stdDev": 234.5
}
// ...
}
```

and don't have to deserialize again.