Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combine alias functions

Tags:

graphite

Using Graphite, I'm plotting some graph and the same with a time shift.

Eg:

aliasByNode(my.application.metric.$Continent.$DC.*, 4, 5, 3)
aliasByNode(timeShift(my.application.metric.$Continent.$DC.*, "7d"), 4, 5, 3)

But I'd like to be able to identify the graphs (they currently get the same name).

How to add a prefix or a suffix (or any marker) to a metric alias?

Eg:

-- EU.PAR.pokemonCaught
-- EU.PAR.pokemonCaught (last week)
like image 740
Alban Dericbourg Avatar asked Jul 25 '16 11:07

Alban Dericbourg


1 Answers

Use regex with aliasSub to grab whole ( (.*) ) metric and change it - add desired text ( \1 last week ). E.g.

aliasByNode(timeShift(my.application.metric.$Continent.$DC.*, "7d"), 4, 5, 3)

should look like

aliasSub(aliasByNode(timeShift(my.application.metric.$Continent.$DC.*, "7d"), 4, 5, 3), "(.*)", "\1 last week")
like image 150
kwarunek Avatar answered Oct 11 '22 17:10

kwarunek