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
Tip
You can initialize Metrics in any other module too. It'll keep track of your aggregate metrics in memory to optimize costs (one blob instead of multiples).
I may be wrong but I think this behavior should also apply to add_dimension. I expect to be able to add_dimension or add_metrics to any Metrics instance. When serializing any one of the instances, an EMF blob is created and it has all metrics and dimensions.
Current Behaviour
When serializing a Metrics instance, dimensions added to other instances do not appear.
Code snippet
deftest_metrics_reuse_dimension_set(metric, dimension, namespace):
# GIVEN Metrics is initializedmy_metrics=Metrics(namespace=namespace)
my_metrics.add_dimension(**dimension)
my_metrics.add_metric(**metric)
# WHEN Metrics is initialized one more timemy_metrics_2=Metrics(namespace=namespace)
# THEN Both class instances should have the same dimension setassertmy_metrics_2.dimension_set==my_metrics.dimension_set
### Possible Solution
_No response_
### Steps to Reproduce
1. Create two `Metrics` instances
2. Pick one to add_metric and add_dimension
3. Serialize another one
### AWS Lambda Powertools for Python version
latest
### AWS Lambda function runtime
3.8
### Packaging format used
PyPi
### Debugging logs
_No response_
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our AWS Lambda Powertools Discord: Invite link
Activity
boring-cyborg commentedon Oct 10, 2022
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our AWS Lambda Powertools Discord: Invite link
heitorlessa commentedon Oct 10, 2022
Thank you @cfchou for raising this - this is a bug. Investigating and once we have a fix we'll make a patch release ASAP
heitorlessa commentedon Oct 10, 2022
Got a fix (thanks to your quick tests too!). Triple checking if I haven't missed anything else before we make a release
github-actions commentedon Oct 10, 2022
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
heitorlessa commentedon Oct 10, 2022
Making a patch release and will share more info soon.
github-actions commentedon Oct 10, 2022
This is now released under 1.31.0 version!
heitorlessa commentedon Oct 10, 2022
Publishing Lambda Layer across 22 AWS regions, should be live in ~10m. Will post here when done.
heitorlessa commentedon Oct 10, 2022
Lambda Layer deployment complete - new version is 38 across all regions.
e.g.,
arn:aws:lambda:eu-west-1:017000801446:layer:AWSLambdaPowertoolsPython:38.Please let us know if this somehow doesn't solve your end @cfchou. Thank you one more time for this great bug report!