·
10 commits
to refs/heads/develop
since this release
Summary
We're thrilled to announce the addition of support for multiple dimension sets within the same Metrics instance. This new feature allows users to gain more granular insights and comprehensive views of their applications by creating aggregating metrics across various dimensions.
Key Features
- New
AddDimensions()
method for adding multiple dimensions at once - Support for multiple dimension sets in a single Metrics instance
- Maintains backwards compatibility with existing
AddDimension()
method - Automatic handling of duplicate dimension sets
- Ensures only the latest dimension value is used as a target member on the root EMF node
Getting Started
To leverage this new functionality, simply use the new AddDimensions()
method in your code:
Metrics.AddDimensions(("environment", "prod"), ("region", "us-west-2"));
Metrics.AddDimensions(("environment", "prod"));
Metrics.AddDimensions(("region", "us-west-2"));
Metrics.AddMetric("ExecutionTime", DateTime.Now, Unit.MILLISECONDS);
This will generate CloudWatch Metrics with multiple dimension sets, allowing for more flexible and detailed metric analysis.
Enhanced Metric Output
The new feature produces an enhanced metric output structure, as shown in this example:
{
"_aws": {
"Timestamp": 1742467748165,
"CloudWatchMetrics": [
{
"Namespace": "HelloWorldFunction",
"Metrics": [
{
"Name": "ExecutionTime",
"Unit": "Milliseconds"
}
],
"Dimensions": [
[
"Service"
],
[
"environment",
"region"
],
[
"environment"
],
[
"region"
]
]
}
]
},
"function_request_id": "c0e5afc1-c033-4aa6-9b13-26bfc324874b",
"ExecutionTime": 0.0,
"environment": "prod",
"functionVersion": "$LATEST",
"Service": "Powertools",
"logStreamId": "$LATEST",
"region": "us-west-2",
"executionEnvironment": "AWS_Lambda_java17"
}
Changes
📜 Documentation updates
- chore(deps): bump squidfunk/mkdocs-material from
eb04b60
to0bfdba4
in /docs (#921) by @dependabot[bot]
🔧 Maintenance
- chore: Update version.json (#925) by @hjgraca
- chore: fix e2e tests (#875) by @hjgraca
- chore: add support for multiple dimensions (#884) by @hjgraca
- chore(deps): bump squidfunk/mkdocs-material from
eb04b60
to0bfdba4
in /docs (#921) by @dependabot[bot]