Bug: publishing a metric with 9 dimensions doesn't work
See original GitHub issueExpected Behaviour
Publishing a CW metric with 9 dimensions should work without problems.
Current Behaviour
When trying to publish a CW metric with 9 dimensions of my own, it seems the metrics never reach CloudWatch, although I can’t see errors anywhere.
Code snippet
with single_metric(
name="MyMetricName",
unit=MetricUnit.Percent,
value=percentage,
namespace=os.environ["POWERTOOLS_METRICS_NAMESPACE"],
) as metric:
metric.add_dimension(name="pool_id", value=metrics.uuid)
metric.add_dimension(name="pool_name", value=metrics.name)
metric.add_dimension(name="pool_min_size", value=metrics.min_size)
metric.add_dimension(name="pool_curr_size", value=metrics.curr_size)
metric.add_dimension(name="pool_real_size", value=metrics.real_curr_size)
metric.add_dimension(name="pool_decommissioning_counter", value=metrics.decommissioning_counter)
metric.add_dimension(name="pool_ready_counter", value=metrics.ready_counter)
metric.add_dimension(name="pool_creating_counter", value=metrics.creating_counter)
return metric
Possible Solution
No response
Steps to Reproduce
- Try to publish a CW metric with 9 dimensions
- let powertools add the
service
dimension on its own - no metrics are published
AWS Lambda Powertools for Python version
1.20.2
AWS Lambda function runtime
3.8
Packaging format used
PyPi
Debugging logs
####################### LAMBDA LOG ENTRY WITH LESS THAN 9 DIMENSIONS ####################
{
"_aws": {
"Timestamp": 1654210920980,
"CloudWatchMetrics": [
{
"Namespace": "phoenix-orchestration",
"Dimensions": [
[
"service_name",
"pool_id",
"pool_name",
"pool_curr_size",
"pool_min_size",
"pool_real_size",
"service"
]
],
"Metrics": [
{
"Name": "SlotAvailability",
"Unit": "Percent"
}
]
}
]
},
"service_name": "tenant-pool",
"pool_id": "c481bab7-ac0c-45d2-bbcc-e5cab7f61156",
"pool_name": "Test Pool",
"pool_curr_size": "11",
"pool_min_size": "11",
"pool_real_size": "11",
"service": "tenant-pool",
"SlotAvailability": [
100
]
}
####################### LAMBDA LOG ENTRY WITH 9 DIMENSIONS ####################
{
"_aws": {
"Timestamp": 1654523221124,
"CloudWatchMetrics": [
{
"Namespace": "phoenix-orchestration",
"Dimensions": [
[
"pool_id",
"pool_name",
"pool_min_size",
"pool_curr_size",
"pool_real_size",
"pool_decommissioning_counter",
"pool_ready_counter",
"pool_creating_counter",
"service"
]
],
"Metrics": [
{
"Name": "SlotAvailability",
"Unit": "Percent"
}
]
}
]
},
"pool_id": "f1316488-6aa6-464f-be78-13902b20ec33",
"pool_name": "Prospects (Ireland) v2",
"pool_min_size": "0",
"pool_curr_size": "0",
"pool_real_size": "0",
"pool_decommissioning_counter": "0",
"pool_ready_counter": "0",
"pool_creating_counter": "0",
"service": "tenant-pool",
"SlotAvailability": [
100
]
}
Issue Analytics
- State:
- Created a year ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
PutMetricData - Amazon CloudWatch - AWS Documentation
Publishes metric data points to Amazon CloudWatch. CloudWatch associates the data points with the specified metric. If the specified metric does not exist, ......
Read more >CloudWatchMetricPublisher fails to publish high QPS detailed ...
Describe the bug When publishing a detailed metric into CloudWatch using CloudWatchMetricPublisher, cloudWatchClient.
Read more >Solved: Google Analytics and Power BI: immediate error aft...
Solved: Hi everyone, When I import data from Google Analytics, it appears there's a bug. First off, to test this, I am importing...
Read more >Troubleshoot Facebook and Instagram publishing errors
This error can occur when trying to publish to a Facebook Page or Instagram account. It means Hootsuite doesn't have all the permissions...
Read more >get-metric-data — AWS CLI 2.9.9 Command Reference
A GetMetricData operation that does not include a query can retrieve as many ... For example, many Amazon EC2 metrics publish InstanceId as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Actually, it’s our bug! CloudWatch Metrics support 10 metric dimensions, however CloudWatch EMF adds 1 “hidden” dimension making the limit 9. We must change our code validation to ensure 8 custom dimensions are the max and raise an exception.
My apologies for the misunderstanding - we’ll publish a fix and make an emergency release by EOD.
@dnlopes Alex (@am29d) is kicking off the Lambda Layer release pipeline across all AWS Commercial Regions we support - it will be version 20. We’ll ping you as soon as that’s available.
Gave you credits in the release notes: https://github.com/awslabs/aws-lambda-powertools-python/releases/tag/v1.26.1
On the breaking change not breaking change (plus any topic), feel free to email us aws-lambda-powertools-feedback@ with your availability and timezone, and we can schedule a call to hear your feedback. We’ll be working on having a regular Office Hours in the future too if you’re busy in the coming weeks/months.
Thank you again! ❤️