Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merge aliasByNode and aliasByMetric in Grafana backed by Graphite

I want to label series by hostname + metric name. I know I can use aliasByNode(1) to do first part and aliasByMetric() to do the second. Any ideas how can I merge those two functions in a single metric?

like image 594
Jakub Kubrynski Avatar asked Jul 09 '16 11:07

Jakub Kubrynski


2 Answers

Something that would solve ALL these problems would just be to have a string with replacement parameters for the metric nodes, like,

aliasByVars("core.app.city.rack.app.instance.thread", 
  "resource: city-$3,rack-$4")

You could intersperse static text with the values of the metric elements (nodes) all you wanted.

That could replace alias, aliasNode, aliasMetric and 99% of aliasSub with one simple, easy to understand namer.

There would be some aliasSub applications where you used partial node names this could not replace.

like image 171
Walt Howard Avatar answered Oct 15 '22 05:10

Walt Howard


aliasByNode can take multiple arguments.

aliasByNode(apps.fakesite.web_server_01.counters.requests.count, 2,5)

returns web_server_01.count.

The Grafana query editor for Graphite does not support this but if you toggle edit mode then you can edit the raw query. After editing it, you can toggle back.

Toggle Edit Mode

enter image description here

End Result

like image 42
Daniel Lee Avatar answered Oct 15 '22 04:10

Daniel Lee