Menu

Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.

Enterprise Open source

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.

Options

  • 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.

Example

Input[0] (From query: A, name: ServerA)

TimeValue
162617811912710
162617811912930

Input[1] (From query: B)

TimeValue
1626178119127100
1626178119129100

Output (Same as Input[0] but now with config on the Value field)

TimeValue (config: Max=100)
162617811912710
162617811912930

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.

Value mappings

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:

ValueTextColor
LLowblue
MMediumgreen
HHighred

In the field mapping specify:

FieldUse asSelect
ValueValue mappings / ValueAll values
TextValue mappings / TextAll values
ColorValue mappings / CiolorAll 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.