Skip to content

3.1.0

Latest

Choose a tag to compare

@github-actions github-actions released this 06 Jan 12:45
· 5 commits to refs/heads/develop since this release
e99abe4

Summary

In this release we are excited to announce support for AWS Lambda Managed Instanced across all Powertools utilities, along with .Net 10 support, and a new typed batch decorator.

Thank you @fuguiKz for your first documentation contribution ⭐

What's New

🚀 Lambda Managed Instances Support

This release introduces full thread safety across all Powertools utilities, enabling seamless support for AWS Lambda Managed Instances.

What are Lambda Managed Instances?

Lambda Managed Instances runs your functions on fully-managed EC2 instances in your account, supporting multi-concurrent invocations where a single execution environment processes multiple requests simultaneously. This improves resource utilization for IO-heavy workloads but requires thread-safe code.

🔒 Thread Safety Improvements

To fully support Lambda Managed Instances, we've implemented thread safety across all utilities:

  • Logging - Per-thread scope storage using ConcurrentDictionary ensures log context isolation between concurrent requests (#1078, #1099)
  • Tracing - Async context preservation with thread-safe segment management (#1082)
  • Metrics - Concurrent collections and isolation prevent metric bleed between requests (#1080)
  • Idempotency - AsyncLocal context and thread-safe configuration for reliable idempotency checks (#1084)
  • Parameters - Immutable cache objects, atomic cache updates with AddOrUpdate, and Interlocked operations for thread-safe parameter retrieval (#1098)

✨ New Features

  • Batch Typed Decorator - New type safe decorator for batch processing, providing new interfaces that accept and serialize automatically your custom types. (#1034)
public class Product
    {
        public int Id { get; set; }
        public string? Name { get; set; }
        public decimal Price { get; set; }
    }

    public class TypedSqsRecordHandler : ITypedRecordHandler<Product> // (1)!
    {
        public async Task<RecordHandlerResult> HandleAsync(Product product, CancellationToken cancellationToken)
        {
             /*
             * Your business logic with automatic deserialization.
             * If an exception is thrown, the item will be marked as a partial batch item failure.
             */

             Logger.LogInformation($"Processing product {product.Id} - {product.Name} (${product.Price})");

             if (product.Id == 4) // (2)!
             {
                 throw new ArgumentException("Error on id 4");
             }

             return await Task.FromResult(RecordHandlerResult.None); // (3)!
         }

    }

    [BatchProcessor(TypedRecordHandler = typeof(TypedSqsRecordHandler))]
    public BatchItemFailuresResponse HandlerUsingTypedAttribute(SQSEvent _)
    {
        return TypedSqsBatchProcessor.Result.BatchItemFailuresResponse; // (4)!
    }

🎯 .NET 10 Support

  • Added .NET 10.0 as a supported target framework (#1105)
  • Removed .NET 6.0 support (end of life) (#1106)

Changes

🌟New features and non-breaking changes

  • feat(logging): thread safety with ConcurrentDictionary for scope storage (#1099) by @hjgraca
  • feat: batch typed decorator (#1034) by @hjgraca
  • feat(idempotency): enhance thread safety with AsyncLocal context and thread-safe configuration (#1084) by @hjgraca
  • feat(tracing): thread safety and async context preservation in Powertools Tracing (#1082) by @hjgraca
  • feat(metrics): thread safety with concurrent collections and isolation for metrics (#1080) by @hjgraca
  • feat(logging): implement thread-safe logging with per-thread scope storage (#1078) by @hjgraca

📜 Documentation updates

  • chore: Fix examples projects to include projectreferences (#1110) by @hjgraca
  • docs: extract batch processing snippets (#1104) by @fuguiKz
  • chore(deps): bump squidfunk/mkdocs-material from 980e11f to 3bba0a9 in /docs (#1107) by @dependabot[bot]
  • chore: update .NET runtime support to 10.0 and remove 6.0 (#1106) by @hjgraca
  • feat: batch typed decorator (#1034) by @hjgraca
  • chore(deps): bump squidfunk/mkdocs-material from f5c556a to 980e11f in /docs (#1057) by @dependabot[bot]

🔧 Maintenance

This release was made possible by the following contributors:

@dependabot[bot], @dreamorosi, @fuguiKz, @hjgraca and dependabot[bot]