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
In this release we are excited to announce a new major release for Metrics 2.0.0 utility and a new Metrics.AspNetCore package that allows Metrics to work with Asp.Net projects (minimal api).
We are also releasing a fix to Logging utility, thanks @gregsinclair42 for reporting and contributing a fix. 🥇
Metrics v2.0.0: A major update introducing enhanced flexibility in metrics handling and new initialization patterns NuGet Metrics.AspNetCore 0.1.0: New package enabling seamless integration with ASP.NET Core projects NuGet Logging 1.6.5: Improved stability and enhanced Lambda context handling NuGet
You can now customize the FunctionName dimension in Cold Start metrics.
This is useful where you want to maintain the same name in case of auto generated handler names (cdk, top-level statement functions, etc.)
The UseMetrics middleware is an extension method for the IApplicationBuilder interface.
It adds a metrics middleware to the specified application builder, which captures cold start metrics (if enabled) and flushes metrics on function exit.
To test your code that uses the Metrics utility, you can use the TestLambdaContext class from the Amazon.Lambda.TestUtilities package.
You can now use the IMetrics interface to mock the Metrics utility in your tests.
Improved validation of ILambdaContext parameters regardless of position in method signature.
Before: The Logging utility only checked if ILambdaContext was null when it was the first parameter. After: The utility now properly validates ILambdaContext at any position in the method signature.
Benefits
Simplified testing: Unit tests can now pass null for ILambdaContext parameters
More robust error handling: Prevents runtime exceptions when invalid contexts are provided
Consistent behavior: Context validation works the same way regardless of parameter position
User experience
Previously, unit tests could be hard to write if a method we call had the [Logging] attribute on it, because then we had to ensure the LambdaContext was set and valid. Now we don't have to worry about the lambda context and can just focus on the code.
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
In this release we are excited to announce a new major release for
Metrics
2.0.0 utility and a newMetrics.AspNetCore
package that allowsMetrics
to work with Asp.Net projects (minimal api).We are also releasing a fix to Logging utility, thanks @gregsinclair42 for reporting and contributing a fix. 🥇
Metrics v2.0.0: A major update introducing enhanced flexibility in metrics handling and new initialization patterns NuGet
Metrics.AspNetCore 0.1.0: New package enabling seamless integration with ASP.NET Core projects NuGet
Logging 1.6.5: Improved stability and enhanced Lambda context handling NuGet
Metrics 2.0.0
Docs
This new major version of Metrics brings some breaking changes to be aware of when considering a move from v1:
Breaking Changes (Action Required) Docs
["service", "Environment"]
[["service", "Environment"]]
metricName
,defaultDimensions
name
,dimensions
New features
Environment Variable Control
New: Use
POWERTOOLS_METRICS_DISABLED
to disable Metrics functionality completely.Docs
Two new ways of creating a Metrics instance:
Docs
Configure Pattern
Builder Pattern
####Adding default dimensions with cold start metric
Docs
You can use the Builder or Configure patterns in your Lambda class constructor to set default dimensions.
Push single Metric
Docs
Improved: The PushSingleMetric method now publishes completely isolated metrics without dimensions by default.
Benefits:
Options for adding dimensions:
Cold start function name
Docs
You can now customize the FunctionName dimension in Cold Start metrics.
This is useful where you want to maintain the same name in case of auto generated handler names (cdk, top-level statement functions, etc.)
AspNetCore support
Docs
The new AWS.Lambda.Powertools.Metrics.AspNetCore package enables seamless metrics collection in ASP.NET Core applications running on Lambda.
Installation
dotnet add package AWS.Lambda.Powertools.Metrics.AspNetCore
Integration Options
Choose between two approaches for adding metrics to your ASP.NET Core Lambda application:
UseMetrics Middleware
Docs
The UseMetrics middleware is an extension method for the IApplicationBuilder interface.
It adds a metrics middleware to the specified application builder, which captures cold start metrics (if enabled) and flushes metrics on function exit.
WithMetrics Filter
Docs
The WithMetrics method is an extension method for the RouteHandlerBuilder class.
It adds a metrics filter to the specified route handler builder, which captures cold start metrics (if enabled) and flushes metrics on function exit.
Testing improvements
Docs
To test your code that uses the Metrics utility, you can use the TestLambdaContext class from the Amazon.Lambda.TestUtilities package.
You can now use the IMetrics interface to mock the Metrics utility in your tests.
Logging 1.6.5
Issue
Issue Fixed
Improved validation of ILambdaContext parameters regardless of position in method signature.
Before: The Logging utility only checked if ILambdaContext was null when it was the first parameter.
After: The utility now properly validates ILambdaContext at any position in the method signature.
Benefits
User experience
Previously, unit tests could be hard to write if a method we call had the [Logging] attribute on it, because then we had to ensure the LambdaContext was set and valid. Now we don't have to worry about the lambda context and can just focus on the code.
This would occur if there was a method like:
Changes
📜 Documentation updates
2615302
to047452c
in /docs (chore(deps): bump squidfunk/mkdocs-material from2615302
to047452c
in /docs #801) by @dependabot[bot]f5bcec4
to2615302
in /docs (chore(deps): bump squidfunk/mkdocs-material fromf5bcec4
to2615302
in /docs #770) by @dependabot[bot]c62453b
tof5bcec4
in /docs (chore(deps): bump squidfunk/mkdocs-material fromc62453b
tof5bcec4
in /docs #764) by @dependabot[bot]🐛 Bug and hot fixes
🔧 Maintenance
2615302
to047452c
in /docs (chore(deps): bump squidfunk/mkdocs-material from2615302
to047452c
in /docs #801) by @dependabot[bot]f5bcec4
to2615302
in /docs (chore(deps): bump squidfunk/mkdocs-material fromf5bcec4
to2615302
in /docs #770) by @dependabot[bot]c62453b
tof5bcec4
in /docs (chore(deps): bump squidfunk/mkdocs-material fromc62453b
tof5bcec4
in /docs #764) by @dependabot[bot]This release was made possible by the following contributors:
@dependabot[bot], @gregsinclair42, @hjgraca, @leandrodamascena, @sthulb and dependabot[bot]
This discussion was created from the release 1.30.
Beta Was this translation helpful? Give feedback.
All reactions