feat(decorators): Support Durable Context in logger and metric decorators#7765
Merged
leandrodamascena merged 6 commits intodevelopfrom Jan 6, 2026
Merged
feat(decorators): Support Durable Context in logger and metric decorators#7765leandrodamascena merged 6 commits intodevelopfrom
leandrodamascena merged 6 commits intodevelopfrom
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:
|
Contributor
Author
|
This PR needs rebasing and updating based on the changes of #7764 |
Contributor
Author
|
I'll rebase and finish this today |
Contributor
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
approved these changes
Jan 6, 2026
Contributor
leandrodamascena
left a comment
There was a problem hiding this comment.
Thanks a lot @ConnorKirk! APPROVED!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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.