I’m trying to make dashboards that let me switch between C and F. I’m able to do this using label filters, but the issue is that the display info is incorrect:
The issue is that the colors are wrong after the unit change. Is there some way to use variables for formatting options? If I could make it scale based on unit selection, that would be great.
Transformation Config from query results
should help:
Thanks, I’m not sure if that does quite what I want. I can’t see how I can make that read a dashboard variable and use that. I also can’t see how to check for a label using the current query.
To be clear, I essentially want it to check the state of the unit in use, if C, set thresholds to a certain level, if F, maybe just convert the threshold using *1.8+32
It is Config from query results
, not Config from dashboard variable
=> you have to make query, which will use that variable first and returns values, which then will be used in that transformation. How to make that query is different question, but you need to be creative (save it in Prometheus, DBs, CSV test data, …). Don’t expect that everything will be straighforward - you will need more steps to achieve desired result.
Could I make a feature request for something like this? I’d be happy defining some dict of sorts in the dashboard that can be used to define config parameters.
I’m imagining some selector for units, that sets values like “unit.TempHigh” “unit.TempLow” where I can use $unit.x or $unit[‘x’] within dashboard config.
I think for cases like this, it almost doesn’t make sense to do a query to resolve a setting define on the dashboard level.
Sure, nobody is stopping you to making a feature request. But I guess next steps after your request will be:
- you will get recommendation to use transformation
Config from query results
(because that was implemented just to have that “dynamic” config
- if it is accepted, then you will be waiting for a moment (years?) until it will be implemeted (or you can implement it on your own of course) - and maybe it won’t be impletemented in your desired way
So is it worth it?
Where would I start implementing this? I think it’s a good feature to have in general. It would not be my first time making a feature request resulting in something close to what I want but not exactly. I recognize project goals differ from mine, but I think some form of this capability would be very nice to have. My only issue with Grafana right now is making panels “DRY”.
I’ll check that out when I get the time. I made a query that filters by the unit name, the issue is that the query returns “1” and I can’t use that transform to get a label name.
I’m not sure how I can use this transform to do what I need.