Config from query results transform
Note: This is a new beta transformation introduced in v8.1.
This transformation allow you select one query and from it extract standard options like Min, Max, Unit and Thresholds and apply it to other query results. This enables dynamic query driven visualization configuration.
If you want to extract a unique config for every row in the config query result then try the Rows to fields transformation instead.
- Config query: Select the query that returns the data you want to use as configuration.
- Apply to: Select what fields or series to apply the configuration to.
- Apply to options: Usually a field type or field name regex depending on what option you selected in Apply to.
Field mapping table
This transformation includes a field table which lists all fields in the data returned by the config query. This table gives you control over what field should be mapped to each config property (the *Use as** option). You can also choose which value to select if there are multiple rows in the returned data.
Input (From query: A, name: ServerA)
Input (From query: B)
Output (Same as Input but now with config on the Value field)
|Time||Value (config: Max=100)|
As you can see each row in the source data becomes a separate field. Each field now also has a max config option set. Options like min, max, unit and thresholds are all part of field configuration and if set like this will be used by the visualization instead of any options manually configured in the panel editor options pane.
You can also transform a query result into value mappings. This is is a bit different as here every row in the config query result will be used to define a single value mapping row. See example below.
Config query result:
In the field mapping specify:
|Value||Value mappings / Value||All values|
|Text||Value mappings / Text||All values|
|Color||Value mappings / Ciolor||All values|
Grafana will build the value mappings from you query result and apply it the the real data query results. You should see values being mapped and colored according to the config query results.
Related Grafana resources
Unify your data with Grafana plugins: Splunk, MongoDB, Datadog, and more
Show how Grafana can be used to take data from multiple different sources and unify it, without disrupting the investments that are working today.
Getting started with Grafana Enterprise and observability
Join the Grafana Labs team for a 30-minute demo of how to get started with the Grafana Stack, so you can go from zero to observability in just a few minutes.