CloudWatch: Dynamic label documentation (#49463)

* dynamic label documentation

* Update docs/sources/datasources/aws-cloudwatch/_index.md

Co-authored-by: JitaC <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/datasources/aws-cloudwatch/_index.md

Co-authored-by: JitaC <70489351+achatterjee-grafana@users.noreply.github.com>

* formatting

Co-authored-by: JitaC <70489351+achatterjee-grafana@users.noreply.github.com>
This commit is contained in:
Erik Sundell 2022-06-07 11:08:12 +02:00 committed by GitHub
parent 113e601dcf
commit 5932a22996
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -293,21 +293,13 @@ A period is the length of time associated with a specific Amazon CloudWatch stat
If the period field is left blank or set to `auto`, then it calculates automatically based on the time range and [cloudwatch's retention policy](https://aws.amazon.com/about-aws/whats-new/2016/11/cloudwatch-extends-metrics-retention-and-new-user-interface/). The formula used is `time range in seconds / 2000`, and then it snaps to the next higher value in an array of predefined periods `[60, 300, 900, 3600, 21600, 86400]` after removing periods based on retention. By clicking `Show Query Preview` in the query editor, you can see what period Grafana used. If the period field is left blank or set to `auto`, then it calculates automatically based on the time range and [cloudwatch's retention policy](https://aws.amazon.com/about-aws/whats-new/2016/11/cloudwatch-extends-metrics-retention-and-new-user-interface/). The formula used is `time range in seconds / 2000`, and then it snaps to the next higher value in an array of predefined periods `[60, 300, 900, 3600, 21600, 86400]` after removing periods based on retention. By clicking `Show Query Preview` in the query editor, you can see what period Grafana used.
#### Alias #### Label
The alias field allows you to override the default name of the metric legend. The label field allows you to override the default name of the metric legend using CloudWatch dynamic labels. If you're using a time-based dynamic label such as `${MIN_MAX_TIME_RANGE}`, then the legend value is derived from the current timezone specified in the time range picker. To see the full list of label patterns and the dynamic label limitations, refer to the [CloudWatch dynamic labels](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/graph-dynamic-labels.html) documentation.
##### Alias patterns **Alias pattern deprecation:** In Grafana 9, dynamic labels have replaced alias patterns in the CloudWatch data source. Any existing alias pattern will get migrated to a corresponding dynamic label pattern. If you wish to use alias patterns instead of dynamic labels, set the feature toggle `cloudWatchDynamicLabels` to `false` in the Grafana configuration file. It will revert to the alias pattern system and use the previous alias formatting logic.
| Alias Pattern | Description | Example Result | The alias field will be deprecated and removed in a release. During this interim period, we wont fix bugs related to the alias pattern system. For details on why we're doing this change, refer to [issue 48434](https://github.com/grafana/grafana/issues/48434).
| ---------------------- | ------------------------------------------------------------- | ---------------- |
| `{{region}}` | returns the region | `us-east-1` |
| `{{period}}` | returns the period | `3000` |
| `{{metric}}` | returns the metric | `CPUUtilization` |
| `{{label}}` | returns the label returned by the API (only in Metric Search) | `i-01343` |
| `{{namespace}}` | returns the namespace (only in Metric Search) | `AWS/EC2` |
| `{{stat}}` | returns the statistic (only in Metric Search) | `Average` |
| `{{[dimension name]}}` | returns the dimension name (only in Metric Search) | `i-01343` |
## Using the Logs query editor ## Using the Logs query editor