-
Notifications
You must be signed in to change notification settings - Fork 466
feat(decorators): Support Durable Context in logger and metric decorators #7765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #7765 +/- ##
===========================================
+ Coverage 96.54% 96.72% +0.17%
===========================================
Files 275 275
Lines 13209 13214 +5
Branches 1006 1006
===========================================
+ Hits 12753 12781 +28
+ Misses 353 325 -28
- Partials 103 108 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This PR needs rebasing and updating based on the changes of #7764 |
|
I'll rebase and finish this today |
Thanks! |
ca68aa6 to
ca87cd3
Compare
c46c4fa to
53acf5b
Compare
This commit updates the Logger and Metric decorators to handle DurableContexts. If a DurableContext is present, it is unwrapped to access the Lambda Context
3cea4b0 to
f5640d2
Compare
|
leandrodamascena
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @ConnorKirk! APPROVED!



Issue number: closes #7763
Summary
This PR updates the Logger and Metric decorators to handle DurableContexts. If a DurableContext is present, it is unwrapped to access the Lambda Context
The
logger.inject_lambda_context()andmetrics.log_metrics()decorators raise an error in some configurations when used with a Durable Execution.The decorators access the Lambda Context. In durable executions, the Lambda Context is wrapped with the Durable Context. The Durable Context is now passed to the handler and thus the decorators.
This affects the
@logger.inject_lambda_context(log_event=True)and@metrics.log_metrics(capture_cold_start_metric=True)decorators (when included params are True). These decorators work without these parameters set. Other decorators do not use the context object, so are not affectedChanges
decorate- Detect if a context is durable or lambda. Extract the lambda contextdecorate- Detect if a context is durable or lambda. Extract the lambda contextdecorate- Detect if a context is durable or lambda. Extract the lambda contextis_durable_contexttypeguardBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.