graphite-web icon indicating copy to clipboard operation
graphite-web copied to clipboard

[Feature request] Query in alias

Open mageo opened this issue 9 years ago • 0 comments

Hello,

I would like to alias metrics based on the value of (an)other metric(s).

For example, if a have the following metrics:

  • channel.power.1
  • channel.frequency.1 (last value = 565)

I would like to alias the first one using the value of the second, so that when I'm graphing channel.power.*, the label for the metric looks like "Channel 565 MHz".

This would require:

  • To extract the meaningful part from the first metric, with a regex for example: /channel.power.([0-9]+)/
  • To build the metric to query using the result of the previous regex: "channel.frequency.$1"
  • To build the final alias using the value returned from the second metric: "Channel $1 MHz"

It could be written as a single function: aliasQuery('/channel.power.([0-9]+)/', 'channel.frequency.$1', 'Channel $1 MHz')

Do you think this would be feasible ?

mageo avatar May 18 '17 15:05 mageo