Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Commit

Permalink
Add example for non-matching dimensions in a metric expression
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-moschinski-dynatrace authored Jul 24, 2023
1 parent cf36abd commit 5d85759
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions metric-example/metric-selector-cheat-sheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,22 @@ number_errors:
:default(0,always)
```

## Non-matching dimensions in a metric expression

For instance, when determining the store's revenue percentage within a city relative to the entire country's revenue, we can use the following expression:
```
revenue_city
:filter("city", "Berlin")
:splitBy("city")
/
revenue_country
:filter("country", "Germany")
:splitBy()
* 100
```
It is essential to use `splitBy()` without any dimension key for the `revenue_country` metric. Without this, the series can't be properly joined. For a successful metric merge in a metric expression, the dimension tuples of both metrics must be identical, or at least one of the metrics needs to be dimensionless. See the [public documentation for details](https://www.dynatrace.com/support/help/dynatrace-api/environment-api/metric-v2/metric-expressions#resolving-expressions).


## Add the parent dimension to the result
For some entity dimensions like `PROCESS_GROUP_INSTANCE` and `SERVICE_METHOD`, you can enrich the result with the "parent" of these dimensions. For example, the metric `builtin:tech.generic.processCount` per default only provides the `dt.entity.process_group_instance` dimension. To get also the host dimension in the result, use the query:
```
Expand Down

0 comments on commit 5d85759

Please sign in to comment.