Skip to content

Releases: aws-powertools/powertools-lambda-dotnet

1.2.0

05 May 12:33
a9f961d
Compare
Choose a tag to compare

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

  • feat: Support for High resolution metrics (#226) by @hjgraca

This release was made possible by the following contributors:

@hjgraca

1.1.0

05 May 11:53
01de762
Compare
Choose a tag to compare

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

  • feat: Powertools User-Agent for Lambda execution environment (#246) by @hjgraca

🔧 Maintenance

This release was made possible by the following contributors:

@amirkaws, @hjgraca, @leandrodamascena, @rubenfonseca and Release bot

v1.0.1

06 Apr 15:41
1c1717b
Compare
Choose a tag to compare

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

This release was made possible by the following contributors:

@amirkaws, @hjgraca, @sliedig and @srcsakthivel

v1.0.0

24 Feb 17:05
5597369
Compare
Choose a tag to compare

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

18 Jan 16:53
f854e95
Compare
Choose a tag to compare
v0.0.2-preview Pre-release
Pre-release

What's Changed

📜 Documentation updates

This release was made possible by the following contributors:

@amirkaws, @sliedig, @sthuber90, @nCubed and @kenfdev

v0.0.1-preview.1

01 Aug 15:21
40389c4
Compare
Choose a tag to compare
v0.0.1-preview.1 Pre-release
Pre-release

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.

⚠️ Do not use this library for production workloads. ⚠️
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.