Juttle Graphite Adapter
Graphite adapter for the Juttle data flow language, with read & write support.
Reading existing metrics is as simple as:
read graphite -from :1 week ago: name ~ 'app1.*.response_ms'| reduce value = avg(value) by name
This will compute last week's average of every metric matching
If you encoded something like the region or hostname into the metric name then
you can easily parse that name in juttle. Let's say your metric name looks
region.host.metric_name. Then you can calculate the average value of the
response time per host every 1 minute for the last 24 hours like so:
read graphite -from :24 hours ago: name ~ '*.response_ms'| put host = String.split(name, '.')| reduce -every :1 minute: value = avg(value) by host
Like Juttle itself, the adapter is installed as a npm package. Both Juttle and the adapter need to be installed side-by-side:
$ npm install juttle$ npm install juttle-graphite-adapter
The adapter needs to be registered and configured so that it can be used from
within Juttle. To do so, add the following to your
carbon specify the location of Graphite storage backend, keys in
webapp contain configuration for the Graphite frontend.
Graphite stores metrics with:
name- alphanumeric sequence defining a path to your metric that you should consider naming appropriately. See graphite documentation for more details.
value- numerical value for the metric identified
timestamp- the timestamp associated with this metric as an integer of seconds since epoch.
When reading data out of graphite every metric will be converted into
a point with the
||moment||no||select points after this time (inclusive)|
||moment||no||select points before this time (exclusive)|
This adapter maps data points containing the fields
time to a graphite metric. All other points missing these fields are not
written and a warning is issued instead.
So, for writing, the key thing is to make sure your data contains the fields
time. When constructing data from a data point that
has multiple fields, make sure to pick a naming convention you can easily use
to parse back out of graphite later. More details on naming your metric can be found
in the graphite wiki.
Want to contribute? Awesome! Don’t hesitate to file an issue or open a pull request.