I'm looking for something similar to sumSeriesWithWildcards, but for max/min. I mean, instead calculating the sum aggregated on the desired fields, it should calculate min or max. I was surprised not to find a maxSeriesWithWildcards call in Graphite library. In case it doesn't exist, how could I simulate that ?
Thanks, Greetings, Sorin
You can use groupByNode
. It takes list of metrics that you want to group by the given node with the specified function - any function can be used.
For example:
test.region-1.server-1
test.region-1.server-2
test.region-1.server-3
test.region-1.server-4
test.region-1.server-5
test.region-2.server-1
test.region-2.server-2
test.region-2.server-3
test.region-2.server-4
test.region-2.server-5
test.region-3.server-1
test.region-3.server-2
test.region-3.server-3
test.region-3.server-4
test.region-3.server-5
to get sums per region you would use:
sumSeriesWithWildcards(test.*.*, 2)
the same you can do with groupByNode*:
groupByNode(test.*.*, 1, 'sumSeries')
Note the node number in sumSeriesWithWildcards
is the one you want to sum, but in the groupByNode
you must specify the node you want to group by. Also the labels will be shorter in the groupByNode - only the grouping node.
So... to the point:
groupByNode(test.*.*, 1, 'minSeries')
groupByNode(test.*.*, 1, 'maxSeries')
groupByNode(test.*.*, 1, 'averageSeries')
There is also groupByNodes
, you can provide more nodes as significant.