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
As part of our ongoing effort to make Powertools fully AOT compatible, we're thrilled to announce Idempotency support for native ahead-of-time (AOT) compilation.
Additionally, we've introduced custom key prefix support for Idempotency.
We've also addressed a bug in our Tracing utility that affected implementations using Top Level Statements.
Special thanks to @nCubed for bringing the Tracing issue to our attention.
To enable Idempotency utility with AOT support, you need to configure the serialization context by adding WithJsonSerializationContext() to your Idempotency configuration.
In the example below, we use the default LambdaFunctionJsonSerializerContext. If you're using the Logging utility, you can alternatively use the PowertoolsSourceGeneratorSerializer.For more information visit our documentation
By default, the idempotency key follows the format [ClassName].[DecoratedMethodName]#[PayloadHash].
With this release, You can now customize this prefix by setting the KeyPrefix property in the Idempotency decorator, making code refactoring more manageable without impacting existing idempotency items.
Previously, string names automatically generated from Tracing-decorated methods weren't sanitized, which could silently fail and prevent traces from appearing in X-Ray due to invalid characters. While this could be addressed by specifying a custom segment name in the Tracing decorator, the custom string itself might still contain invalid characters.
To resolve this, we've implemented two improvements:
Added documentation describing valid characters for segment names
Implemented automatic string sanitization for both auto-generated and custom segment names
These changes ensure that no traces are dropped due to invalid characters in segment names, maintaining reliable trace data collection in X-Ray.
/// <summary>/// Set custom segment name for the operation./// The default is '## {MethodName}'.////// The logical name of the service that handled the request, up to 200 characters. /// Names can contain Unicode letters, numbers, and whitespace, and the following symbols: \_, ., :, /, %, &, #, =, +, \\, -, @/// </summary>publicstringSegmentName{get;set;}="";
usingSystem.Text.RegularExpressions;publicstaticstringSanitizeString(stringinput){// Define a regular expression pattern to match allowed charactersstringpattern=@"[^a-zA-Z0-9\s_\.\:/%&#=+\-@]";// Replace any character that does not match the pattern with an empty stringreturnRegex.Replace(input,pattern,string.Empty);}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Summary
As part of our ongoing effort to make Powertools fully AOT compatible, we're thrilled to announce Idempotency support for native ahead-of-time (AOT) compilation.
Additionally, we've introduced custom key prefix support for Idempotency.
We've also addressed a bug in our Tracing utility that affected implementations using Top Level Statements.
Special thanks to @nCubed for bringing the Tracing issue to our attention.
Idempotency AOT
Docs
To enable Idempotency utility with AOT support, you need to configure the serialization context by adding WithJsonSerializationContext() to your Idempotency configuration.
In the example below, we use the default LambdaFunctionJsonSerializerContext. If you're using the Logging utility, you can alternatively use the PowertoolsSourceGeneratorSerializer.For more information visit our documentation
Full example
Idempotency custom key prefix
Docs
By default, the idempotency key follows the format [ClassName].[DecoratedMethodName]#[PayloadHash].
With this release, You can now customize this prefix by setting the KeyPrefix property in the Idempotency decorator, making code refactoring more manageable without impacting existing idempotency items.
Tracing segment name sanitization
Tracing segment name docs and X-Ray docs
Previously, string names automatically generated from Tracing-decorated methods weren't sanitized, which could silently fail and prevent traces from appearing in X-Ray due to invalid characters. While this could be addressed by specifying a custom segment name in the Tracing decorator, the custom string itself might still contain invalid characters.
To resolve this, we've implemented two improvements:
These changes ensure that no traces are dropped due to invalid characters in segment names, maintaining reliable trace data collection in X-Ray.
Changes
📜 Documentation updates
7e841df
toc62453b
in /docs (chore(deps): bump squidfunk/mkdocs-material from7e841df
toc62453b
in /docs #748) by @dependabot[bot]471695f
to7e841df
in /docs (chore(deps): bump squidfunk/mkdocs-material from471695f
to7e841df
in /docs #744) by @dependabot[bot]41942f7
to471695f
in /docs (chore(deps): bump squidfunk/mkdocs-material from41942f7
to471695f
in /docs #739) by @dependabot[bot]🔧 Maintenance
7e841df
toc62453b
in /docs (chore(deps): bump squidfunk/mkdocs-material from7e841df
toc62453b
in /docs #748) by @dependabot[bot]471695f
to7e841df
in /docs (chore(deps): bump squidfunk/mkdocs-material from471695f
to7e841df
in /docs #744) by @dependabot[bot]41942f7
to471695f
in /docs (chore(deps): bump squidfunk/mkdocs-material from41942f7
to471695f
in /docs #739) by @dependabot[bot]This release was made possible by the following contributors:
@dependabot[bot], @hjgraca and dependabot[bot]
This discussion was created from the release 1.20.
Beta Was this translation helpful? Give feedback.
All reactions