mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 18:30:41 -06:00
Docs: Update labels to fields transform (#30086)
* Docs: Update labels to fields transform * Update docs/sources/panels/transformations/types-options.md Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com> * Update docs/sources/panels/transformations/types-options.md Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com> * Moved merge info to before examples * Update docs/sources/panels/transformations/types-options.md Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> * More review updates * Update docs/sources/panels/transformations/types-options.md Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com> Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
This commit is contained in:
parent
7aa6926ef6
commit
e270a2de9e
@ -188,14 +188,12 @@ In the example below, I added two fields together and named them Sum.
|
||||
|
||||
## Labels to fields
|
||||
|
||||
> **Note:** In order to apply this transformation, your query needs to return labeled fields.
|
||||
This transformation changes time series results that include labels or tags into to a table structure where each label becomes its own field.
|
||||
|
||||
When you select this transformation, Grafana automatically transforms all labeled data into fields.
|
||||
Given a query result of two time series:
|
||||
|
||||
Example: Given a query result of two time series
|
||||
|
||||
1: labels Server=Server A, Datacenter=EU
|
||||
2: labels Server=Server B, Datacenter=EU
|
||||
* Series 1: labels Server=Server A, Datacenter=EU
|
||||
* Series 2: labels Server=Server B, Datacenter=EU
|
||||
|
||||
This would result in a table like this:
|
||||
|
||||
@ -204,7 +202,7 @@ This would result in a table like this:
|
||||
| 2020-07-07 11:34:20 | Server A | EU | 1 |
|
||||
| 2020-07-07 11:34:20 | Server B | EU | 2 |
|
||||
|
||||
**Value field name**
|
||||
### 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.
|
||||
|
||||
@ -212,13 +210,31 @@ If you selected Server as the **Value field name**, then you would get one field
|
||||
| ------------------- | ---------- | -------- | -------- |
|
||||
| 2020-07-07 11:34:20 | EU | 1 | 2 |
|
||||
|
||||
For this example, I manually defined labels in the Random Walk visualization of TestData DB.
|
||||
### Merging behavior
|
||||
|
||||
{{< docs-imagebox img="/img/docs/transformations/labels-to-fields-before-7-0.png" class="docs-image--no-shadow" max-width= "1100px" >}}
|
||||
The labels to fields transformer is internally two separate transformations. The first acts on single series and extracts labels to fields. The second is the [merge](#merge) transformation that joins all the results into a single table. The merge transformation tries to join on all matching fields. This merge step is required and cannot be turned off.
|
||||
|
||||
After I apply the transformation, my labels appear in the table as fields.
|
||||
To illustrate this, here is an example where you have two queries that return time series with no overlapping labels.
|
||||
|
||||
{{< docs-imagebox img="/img/docs/transformations/labels-to-fields-after-7-0.png" class="docs-image--no-shadow" max-width= "1100px" >}}
|
||||
* Series 1: labels Server=ServerA
|
||||
* Series 2: labels Datacenter=EU
|
||||
|
||||
This will first result in these two tables:
|
||||
|
||||
| Time | Server | Value |
|
||||
| ------------------- | ------- | ----- |
|
||||
| 2020-07-07 11:34:20 | ServerA | 10
|
||||
|
||||
| Time | Datacenter | Value |
|
||||
| ------------------- | ---------- | ----- |
|
||||
| 2020-07-07 11:34:20 | EU | 20
|
||||
|
||||
After merge:
|
||||
|
||||
| Time | Server | Value | Datacenter |
|
||||
| ------------------- | ------- | ----- | ---------- |
|
||||
| 2020-07-07 11:34:20 | ServerA | 10 | |
|
||||
| 2020-07-07 11:34:20 | | 20 | EU |
|
||||
|
||||
## Group by
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user