Question

How easy it is to add new tags in graphite?

For example Suppose I am adding data to one metric like this.

count.chrome 12 time
count.ie 10 time

Now I add new tag in graphite metric like this

count.chrome.host1 10 time
count.chrome.host2 11 time
count.ie.host2 9 time

I think we can do above thing as long as the tag position remains same in the metric. But my question is how do I query now to aggregate data.

For example I want to query sum of count of all browsers. Can I do something like this for the same?

sumSeries(count.*)

Above should give me 52 and not 22.

or do I have to do following to get the right answer

sumSeries(count.*,count.*.*)

If we have to do the second option then that means we have to remember all possible metric names for a particular metric to get the correct data and that means its not practical to add variable number of tags in graphite.

Was it helpful?

Solution

"For example I want to query sum of count of all browsers. Can I do something like this for the same? sumSeries(count.*)"

No, actually. Why? A wildcard is applicable to only at that depth of the subtree. So your * will not resolve all subtrees beneath the metric where you use it, but will just give you all possible paths at that level.

count.chrome 12 time
count.ie 10 time
count.chrome.host1 10 time
count.chrome.host2 11 time
count.ie.host2 9 time

In this case, the metric tree would be like-

count/chrome.wsp
count/ie.wsp
count/chrome/host1.wsp 
count/chrome/host2.wsp 
count/ie/host2.wsp

So as you see, chrome and ie are both metrics and directories here. Querying multiple levels indeed requires a query like- sumSeries(count.*,count.*.*,count.*.*.*)

"that means we have to remember all possible metric names"

Not really. With a little intelligent naming scheme for your metrics, you can easily bypass this limitation. What you have to know is the maximum depth of your tree. Also, Graphite supports all perl-based regexes, so you aren't limited to just *.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top