I created a new Graph in Grafana that takes data from OpenTSDB.
The Alias field has the following value: Label $metric $tag_host
.
when it is interpreted, it looks like this:
Label $metric myhost1
Label $metric myhostn
but I want to look like this:
Label xyz myhost1
Label xyz myhostn
where xyz
is the value of the Metric field.So, for a key (E.g.: host
) in Tags, I can use $tag_<key>
(E.g.: $tag_host
) in Alias.
I want to achieve the same behavior for the hard-coded Metric value (E.g.: xyz
), such that if someone wants to change the Metric value in the future from xyz
to abc
, the Alias should be updated automatically.
I tried to use:
$metric
$Metric
$tag_metric
but they didn't work.
Is it possible to use the Metric value in Alias without hard-coding in Alias (the hard-coding from Metric is enough)?
My solution: I included second tag (first one was id
- $tag_id
) into GROUP BY
(tag(sql)
) and then I used $tag_sql
($tag_key
) variable to define alias for current series of data thus:
Highlighted fields are tags.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With