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
{{ message }}
Repository navigation
Feature: Integrate custom metrics with new CloudWatch embedded metric #1
At a first glance, it looks like it worth bringing as an additional dependency as it handles a few edge cases w/ dimensions, captures Lambda context including trace ID, etc.
Pros
Captures Lambda context as high-cardinality data
Handles dimensions and other limits
Cons
Another dependency
metric_scope decorator doesn't take into account outer functions where metrics could also be generated
On a second look, we could implement a serializer and get away with a simpler interface
Will put it to test, looking at the Lambda specific implementation a Serializer and a print could do.
Chatting with @nmoutschen, it's possible to keep a simpler interface like we have with log_metric but change the implementation to keep metrics in state and flush them upon handler return.
Initial idea to try possibly next week:
Keep the simpler to use log_metric(name, value, unit, dimensions, etc.)
Another discovery that I overlooked at first - Dimensions are shared across all metrics within the array to be flushed. That could easily bring costs up if one is not aware of that since each dimension creates a new metric.
I'll port to the Serverless Airline project first that still uses the original version of the powertools. Then, I'll create a PR and fully document it.
Activity
heitorlessa commentedon Nov 18, 2019
PR implementing Lambda support in new CW Library: awslabs/aws-embedded-metrics-python@a352d40
At a first glance, it looks like it worth bringing as an additional dependency as it handles a few edge cases w/ dimensions, captures Lambda context including trace ID, etc.
Pros
Cons
Will put it to test, looking at the Lambda specific implementation a Serializer and a print could do.
heitorlessa commentedon Nov 19, 2019
Chatting with @nmoutschen, it's possible to keep a simpler interface like we have with log_metric but change the implementation to keep metrics in state and flush them upon handler return.
Initial idea to try possibly next week:
Working example - Gotcha here is that timestamp must be in ms
fix: attempt to make GitHub Actions work #1
heitorlessa commentedon Apr 2, 2020
Another discovery that I overlooked at first - Dimensions are shared across all metrics within the array to be flushed. That could easily bring costs up if one is not aware of that since each dimension creates a new metric.
heitorlessa commentedon Apr 7, 2020
First implementation -> https://gist.github.com/heitorlessa/5c918d35073bc4c7223de7ffdcc18735
I'll port to the Serverless Airline project first that still uses the original version of the powertools. Then, I'll create a PR and fully document it.
Leaving it here in case someone needs it
chore: trigger CI #1
fix: import time latency by lazily loading high level modules (#301)
github-actions commentedon May 6, 2025
This is now released under 3.12.0 version!
github-actions commentedon Jun 19, 2025
This is now released under 3.15.0 version!