-
Notifications
You must be signed in to change notification settings - Fork 31
Closed
Labels
area/metricsCore metrics utilityCore metrics utilitybugUnexpected, reproducible and unintended software behaviourUnexpected, reproducible and unintended software behaviourpending-releaseFix or implementation already in dev waiting to be releasedFix or implementation already in dev waiting to be releasedv2v2 releasev2 release
Milestone
Description
Expected Behaviour
I expect to be able to push metrics with multiple dimensions either via PushSingleMetric
or multiple calls to AddDimension
.
Current Behaviour
When using any of the following:
Metrics.SetDefaultDimensions(new Dictionary<string, string> {
{ "SessionId", input.SessionId ?? "Unset" }
});
Metrics.PushSingleMetric("Lambda Execute", 1, MetricUnit.Count, metricResolution: MetricResolution.High,
defaultDimensions: new Dictionary<string, string> {
{ "Type", "Start" }
});
Metrics.PushSingleMetric("Lambda Execute", 1, MetricUnit.Count, metricResolution: MetricResolution.High,
defaultDimensions: new Dictionary<string, string> {
{ "Type", "Start" },
{ "SessionId", input.SessionId ?? "Unset" }
});
Metrics.AddMetric("Lambda Execute", 1, MetricUnit.Count, MetricResolution.High);
Metrics.AddDimension("SessionId", input.SessionId ?? "Unset");
Metrics.AddDimension("Type", "Start");
The following EMF is logged:
{
"_aws": {
"Timestamp": 1728338129260,
"CloudWatchMetrics": [
{
"Namespace": "Services",
"Metrics": [
{
"Name": "Lambda Execute",
"Unit": "Count",
"StorageResolution": 1
}
],
"Dimensions": [
[
"SessionId"
],
[
"Type"
],
[
"Service"
]
]
}
]
},
"SessionId": "3da49fdb-aa91-4523-a6ea-a030817d2410",
"Type": "Start",
"Service": "coordinator",
"Lambda Execute": 1
}
And the following appears in the CloudWatch console:
Essentially, it creates 3 different metrics for each dimension.
Code snippet
Metrics.AddMetric("Lambda Execute", 1, MetricUnit.Count, MetricResolution.High);
Metrics.AddDimension("SessionId", input.SessionId ?? "Unset");
Metrics.AddDimension("Type", "Start");
Possible Solution
No response
Steps to Reproduce
See code snippet
Powertools for AWS Lambda (.NET) version
latest
AWS Lambda function runtime
dotnet8
Debugging logs
No response
Metadata
Metadata
Assignees
Labels
area/metricsCore metrics utilityCore metrics utilitybugUnexpected, reproducible and unintended software behaviourUnexpected, reproducible and unintended software behaviourpending-releaseFix or implementation already in dev waiting to be releasedFix or implementation already in dev waiting to be releasedv2v2 releasev2 release
Type
Projects
Status
✅ Done