'Grafana exclude values from query with wildcard
I have a grafana query that sums a number of stats, my query looks like
alias(summarize(sumSeries(stats.checkout-*.*.*.*.*), '$time', 'sum', false), 'checkout')
The names from graphite are country based i.e.
stats.checkout-uk
stats.checkout-es
stats.checkout-it
This all works ok but I would now like to exclude a few countries from the results i.e. i don't want to include stats.checkout-es
(there are maybe 3 or 4 I need to exclude). I don't want to manually write out the values for each country and somehow sum them together (seems the wrong way).
How can I exclude just certain names from the query whilst still using my wildcard ?
Solution 1:[1]
If you don't need alerts you could use transformations
Filter data by name Filter data by query Filter data by value
https://grafana.com/docs/grafana/latest/panels/transformations/
Solution 2:[2]
alias(summarize(sumSeries(exclude(stats.checkout-*.*.*.*.*),"checkout-es"), '$time', 'sum', false), 'checkout')
This should be work.
https://graphite.readthedocs.io/en/latest/functions.html#graphite.render.functions.exclude
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Luke Patrick |
Solution 2 | Haven Lin |