You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/core/metrics.md
+30-9Lines changed: 30 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ If you're new to Amazon CloudWatch, there are five terminologies you must be awa
22
22
***Dimensions**. Metrics metadata in key-value format. They help you slice and dice metrics visualization, for example `ColdStart` metric by Payment `service`.
23
23
***Metric**. It's the name of the metric, for example: `SuccessfulBooking` or `UpdatedBooking`.
24
24
***Unit**. It's a value representing the unit of measure for the corresponding metric, for example: `Count` or `Seconds`.
25
-
***Resolution**. It's a value representing the storage resolution for the corresponding metric. Metrics can be either Standard or High resolution. Read more [here](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html#high-resolution-metrics){target="_blank"}.
25
+
***Resolution**. It's a value representing the storage resolution for the corresponding metric. Metrics can be either Standard or High resolution. Read more in the [high-resolution metrics documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html#high-resolution-metrics){target="_blank"}.
@@ -136,6 +136,27 @@ If you'd like to remove them at some point, you can use `clear_default_dimension
136
136
137
137
**Note:** Dimensions with empty values will not be included.
138
138
139
+
### Adding multiple dimension sets
140
+
141
+
You can use `add_dimensions` method to create multiple dimension sets in a single EMF blob. This allows you to aggregate metrics across different dimension combinations without emitting separate metric blobs.
142
+
143
+
Each call to `add_dimensions` creates a new dimension array in the CloudWatch EMF output, enabling different views of the same metric data.
Use `add_dimensions` when you need to query the same metric with different dimension combinations. For example, you might want to see `SuccessfulBooking` aggregated by `environment` alone, or by both `environment` and `region`.
159
+
139
160
### Changing default timestamp
140
161
141
162
When creating metrics, we use the current timestamp. If you want to change the timestamp of all the metrics you create, utilize the `set_timestamp` function. You can specify a datetime object or an integer representing an epoch timestamp in milliseconds.
@@ -233,12 +254,12 @@ The priority of the `function_name` dimension value is defined as:
233
254
234
255
The following environment variable is available to configure Metrics at a global scope:
|**Namespace Name**| Sets **namespace** used for metrics.|`POWERTOOLS_METRICS_NAMESPACE`|`None`|
260
+
|**Service**| Sets **service** metric dimension across all metrics e.g. `payment`|`POWERTOOLS_SERVICE_NAME`|`None`|
261
+
|**Function Name**| Function name used as dimension for the **ColdStart** metric.|`POWERTOOLS_METRICS_FUNCTION_NAME`|`None`|
262
+
|**Disable Powertools Metrics**|**Disables** all metrics emitted by Powertools.|`POWERTOOLS_METRICS_DISABLED`|`None`|
242
263
243
264
`POWERTOOLS_METRICS_NAMESPACE` is also available on a per-instance basis with the `namespace` parameter, which will consequently override the environment variable value.
244
265
@@ -393,8 +414,8 @@ We provide a thin-wrapper on top of the most requested observability providers.
0 commit comments