Releases: aws-powertools/powertools-lambda-dotnet
1.2.0
Changes
Tracing and Logging utilities remain on 1.1.0 (no changes)
Metrics 1.2.0
Metrics produced by AWS services are standard resolution by default. When you publish a custom metric, you can define it as either standard resolution or high resolution. When you publish a high-resolution metric, CloudWatch stores it with a resolution of 1 second, and you can read and retrieve it with a period of 1 second, 5 seconds, 10 seconds, 30 seconds, or any multiple of 60 seconds.
High-resolution metrics can give you more immediate insight into your application's sub-minute activity. Keep in mind that every PutMetricData call for a custom metric is charged, so calling PutMetricData more often on a high-resolution metric can lead to higher charges. For more information about CloudWatch pricing, see Amazon CloudWatch Pricing.
If you set an alarm on a high-resolution metric, you can specify a high-resolution alarm with a period of 10 seconds or 30 seconds, or you can set a regular alarm with a period of any multiple of 60 seconds. There is a higher charge for high-resolution alarms with a period of 10 or 30 seconds.
{ "_aws":{ "Timestamp":1680086851067, "CloudWatchMetrics":[ { "Namespace":"dotnet-powertools-test", "Metrics":[ { "Name":"Time", "Unit":"Milliseconds", "StorageResolution":60 <---- New property } ], "Dimensions":[ [ "Service" ], [ "functionVersion" ] ] } ] }, "Service":"testService", "functionVersion":"$LATEST", "Time":100.5 }
User experience
using AWS.Lambda.Powertools.Metrics;
public class Function {
[Metrics(Namespace = "ExampleApplication", Service = "Booking")]
public async Task<APIGatewayProxyResponse> FunctionHandler(APIGatewayProxyRequest apigProxyEvent, ILambdaContext context)
{
// Publish a metric with standard resolution i.e. StorageResolution = 60
Metrics.AddMetric("SuccessfulBooking", 1, MetricUnit.Count, MetricResolution.Standard);
// Publish a metric with high resolution i.e. StorageResolution = 1
Metrics.AddMetric("FailedBooking", 1, MetricUnit.Count, MetricResolution.High);
// The last parameter (storage resolution) is optional
Metrics.AddMetric("SuccessfulUpgrade", 1, MetricUnit.Count);
}
}
When method is called without MetricsResolution
parameter it will default to not sending StorageResolution.
2023-04-26T15:07:43.552Z 49e1f9a4-9b00-4462-b111-478fcd8ceffa info {
"_aws": {
"Timestamp": 1682521663552,
"CloudWatchMetrics": [
{
"Namespace": "ServerlessGreeting",
"Metrics": [
{
"Name": "SuccessfulBooking",
"Unit": "Count",
"StorageResolution": 60
},
{
"Name": "FailedBooking",
"Unit": "Count",
"StorageResolution": 1
},
{
"Name": "SuccessfulUpgrade",
"Unit": "Count"
}
],
"Dimensions": [
[
"Service"
]
]
}
]
},
"Service": "ServerlessGreeting",
"GetGreeting_Invocations": 1,
"High": 1
}
🌟New features and non-breaking changes
This release was made possible by the following contributors:
1.1.0
Changes
In this release we introduced telemetry for Powertools user-agent for Lambda Execution Environment.
This will allow us to have visibility on Powertools invocations.
🌟New features and non-breaking changes
🔧 Maintenance
- chore(governance): add Lambda Powertools for Python in issue templates (#251) by @leandrodamascena
- chore(ci): add workflow to dispatch analytics fetching (#248) by @rubenfonseca
- update changelog with latest changes (#241) by @hjgraca
- update pipeline to create a new branch instead of push (#237) by @hjgraca
- fix: Update NuGet references for examples (#235) by @amirkaws
This release was made possible by the following contributors:
@amirkaws, @hjgraca, @leandrodamascena, @rubenfonseca and Release bot
v1.0.1
Changes
In this minor release we have addressed a bug in the Tracing utility that when an exception was thrown the Tracing utility would override the error and throw a InvalidOperationException instead of the correct exception.
We have also improved the documentation for Metrics utility, there was wrong casing in the examples. Thanks @srcsakthivel
Finally there was maintenance work done on the NuGet references for examples and changelog. Changelog still in progress and will be fixed soon.
🐛 Bug and hot fixes
- Fix Tracing when exception is thrown. Prevent Tracing from throwing InvalidOperationException (#223) by @hjgraca
🔧 Maintenance
- chore : add changelog to makefile (#227) by @hjgraca
- chore: Bump versions for release v1.0.1 (#232) by @amirkaws
- fix: update NuGet references for examples (#218) by @amirkaws
- chore(docs) - Metrics doc updates (#225) by @srcsakthivel
This release was made possible by the following contributors:
v1.0.0
With this release, we move from release candidate to General Availability 🎉🎉🎉!
This means APIs for the core utilities Tracing, Logging, and Metrics are now stable and they are ready to be used in AWS Lambda functions written in .NET 6 running in production.
Quick links: 📜 Documentation | NuGet | Roadmap | Examples
Logging
Key features
- Capture key fields from Lambda context, cold start and structures logging output as JSON
- Log Lambda event when instructed (disabled by default)
- Log sampling enables DEBUG log level for a percentage of requests (disabled by default)
- Append additional keys to structured log at any point in time
For more information see Logging documentation.
Metrics
Key features
- Aggregate up to 100 metrics using a single CloudWatch EMF object (large JSON blob)
- Validate against common metric definitions mistakes (metric unit, values, max dimensions, max metrics, etc)
- Metrics are created asynchronously by CloudWatch service, no custom stacks needed
- Context manager to create a one off metric with a different dimension
For more information see Metrics documentation.
Tracing
Key features
- Helper methods to improve the developer experience for creating custom AWS X-Ray subsegments.
- Capture cold start as annotation.
- Capture function responses and full exceptions as metadata.
- Better experience when developing with multiple threads.
- Auto-patch supported modules by AWS X-Ray
For more information see Tracing documentation.
Special thank you
We'd like to extend our gratitude to the following people who helped with contributions, feedbacks, and their opinions while we were in developer preview:
@heitorlessa, @t1agob, @sthuber90, @nCubed, @kenfdev, @msimpsonnz, and @pgrm
v0.0.2-preview
What's Changed
- fix: custom exception JSON converter (#152) by @amirkaws
- fix: updated logger casing env vars in samples (#173) by @sliedig
- chore: updated NuGet packages (#172) by @sliedig
📜 Documentation updates
- docs: fix documentation links (#147) by @amirkaws
- docs: add discord invitation link (#155) by @sthuber90
- fix: some grammar; update links to example projects. (#170) by @nCubed
- docs: typo in metrics README (#157) by @kenfdev
- docs: updated documentation (#175) by @sliedig
This release was made possible by the following contributors:
@amirkaws, @sliedig, @sthuber90, @nCubed and @kenfdev
v0.0.1-preview.1
Summary
Introducing AWS Lambda Powertools for .NET, a suite of utilities for AWS Lambda functions running on the .NET 6 runtime, to ease the adoption of best practices such as tracing, structured logging, custom metrics, and more.
AWS Lambda Powertools for .NET is currently released in preview and is intended strictly for feedback purposes only.
This version is not stable, and significant breaking changes might incur as part of the upcoming production-ready release.
--
Quick links: 📜 Documentation | ⬇️ NuGet | 💬 Feature request | 🐛 Bug Report | ⚡️Examples
Logger
🤩 Key features 🤩
- Capture key fields from Lambda context, cold start and structures logging output as JSON
- Log Lambda event when instructed (disabled by default)
- Log sampling enables DEBUG log level for a percentage of requests (disabled by default)
- Append additional keys to structured log at any point in time
Metrics
🤩 Key features 🤩
- Aggregate up to 100 metrics using a single CloudWatch EMF object (large JSON blob)
- Validate against common metric definitions mistakes (metric unit, values, max dimensions, max metrics, etc)
- Metrics are created asynchronously by CloudWatch service, no custom stacks needed
- Context manager to create a one off metric with a different dimension
Tracer
🤩 Key features 🤩
- Helper methods to improve the developer experience for creating custom AWS X-Ray subsegments.
- Capture cold start as annotation.
- Capture function responses and full exceptions as metadata.
- Better experience when developing with multiple threads.
- Auto-patch supported modules by AWS X-Ray
This release was made possible by the following contributors:
@sliedig , @amirkaws , @t1agob, @heitorlessa
Credits
Credits for the Lambda Powertools idea go to DAZN with their DAZN Lambda Powertools.