ripienaar/graphite-graph-dsl — Issue #7: give possibility to use substr() instead of alias() for some fields
Author: lelutin
Created: 2012-01-05 00:42:20+00:00
State: open

The default behaviour of using alias() to force a meaningful label for a field really makes sense.

Although, sometimes we'd like to use graphite's abitilty to fetch a series of values instead of just one. Using alias() on a series of values traces lines for all values in the series but creates only one label for all of them.

One example of such a graph, that I was mentioning by e-mail could be that one wants to get the top 10 domains from a web server that generate the most traffic:

substr(highestAverage(nodes.*.apache.bytes, 10), 1, 2)

Since we don't know which ones will come out, we can't just enumerate the 10 fields.

It would be interesting to be able to make "field" use substr instead of alias. It could be another construct, but it would have pretty much the same properties as "field".. and it would still be possible to use the graphite functions that fetch multiple values in the :data argument to "field".

So, I would suggest having something like :substr => [being, end] in "field" to replace the alias.