Transformations: support a rows mode in labels to fields (#41020)

This commit is contained in:
Ryan McKinley
2021-11-04 17:12:01 +01:00
committed by GitHub
parent aac3f88603
commit 70e92ef987
4 changed files with 348 additions and 37 deletions
@@ -192,20 +192,33 @@ In the example below, I added two fields together and named them Sum.
## Labels to fields
This transformation changes time series results that include labels or tags into to a table structure where each label becomes its own field.
This transformation changes time series results that include labels or tags into to a table structure where each label keys and values
are included in the table result. The labels can be displayed either as columns or as row values.
Given a query result of two time series:
- Series 1: labels Server=Server A, Datacenter=EU
- Series 2: labels Server=Server B, Datacenter=EU
This would result in a table like this:
In "Columns" mode, the result looks like this:
| Time | Server | Datacenter | Value |
| ------------------- | -------- | ---------- | ----- |
| 2020-07-07 11:34:20 | Server A | EU | 1 |
| 2020-07-07 11:34:20 | Server B | EU | 2 |
In "Rows" mode, the result has a table for each series and show each label value like this:
| label | value |
| ---------- | -------- |
| Server | Server A |
| Datacenter | EU |
| label | value |
| ---------- | -------- |
| Server | Server B |
| Datacenter | EU |
### Value field name
If you selected Server as the **Value field name**, then you would get one field for every value of the Server label.