Skip to content

3.2.0

Choose a tag to compare

@github-actions github-actions released this 12 Mar 14:42
c4492d7

Summary

In this release we added new logging features including ExtraKeys for temporary key management within scopes, an Enabled property for LogBuffering configuration, and TenantId support for Lambda Tenant Isolation observability. We also fixed a stdout file descriptor leak in the logging utility and an idempotency key collision issue when using multiple idempotent methods.

Thank you @jihed-garaouch for your first contribution ⭐

What's New

✨ ExtraKeys for Logger

| Docs

Added ExtraKeys() method to Logger for temporary key management within scopes. Keys are automatically cleaned up when the scope exits, with full support for async/await boundaries using AsyncLocal-based scope storage. Supports multiple overloads: Dictionary, params tuples, and nested scopes.

Dictionary syntax:

using (Logger.ExtraKeys(new Dictionary<string, object> { {"orderId", "123"} }))
{
    Logger.LogInformation("Processing order"); // includes orderId
}
// orderId is automatically removed

Tuple syntax:

using (Logger.ExtraKeys(("orderId", "123"), ("customerId", "456")))
{
    Logger.LogInformation("Processing"); // includes orderId and customerId
}

✨ LogBuffering Enabled Property

| Docs

Added Enabled property to LogBufferingOptions to explicitly control log buffering activation. This allows configuring log buffering through property assignment instead of requiring constructor parameters.

var builder = new LoggerConfiguration();
builder.LogBuffering.Enabled = true;
builder.LogBuffering.BufferAtLogLevel = LogLevel.Debug;

✨ TenantId Support

Added TenantId from ILambdaContext to the default logger properties to support AWS Lambda Tenant Isolation observability. When using Lambda Tenant Isolation, the TenantId is automatically captured and included in your structured log output.

{
    "Level": "Information",
    "Message": "Processing request",
    "TenantId": "tenant-abc-123",
    ...
}

🐛 Stdout File Descriptor Leak Fix

Fixed a file descriptor leak in ConsoleWrapper where OverrideLambdaLogger() was creating a new StreamWriter(Console.OpenStandardOutput()) on every log write, leaking one pipe file descriptor per call. Under sustained load in warm Lambda containers this exhausted the 1024 FD limit and crashed the function with "Too many open files". The stdout stream is now opened once and reused.

🐛 Idempotency Key Collision Fix

Fixed an issue where multiple idempotent methods with the same key would share the same idempotency record. The persistence store now uses AsyncLocal for the full function name, correctly isolating keys per method.

// Before: both methods would generate the same idempotency key
// After: each method generates a unique key based on the full function name

[Idempotent]
public Task<Response> MethodA(string key) { ... }

[Idempotent]
public Task<Response> MethodB(string key) { ... }

Changes

🌟New features and non-breaking changes

📜 Documentation updates

  • chore(deps): bump markdown from 3.7 to 3.8.1 in /docs (#1144) by @dependabot[bot]
  • chore(deps): bump squidfunk/mkdocs-material from 3bba0a9 to 8f41b60 in /docs (#1141) by @dependabot[bot]
  • feat(logging): add ExtraKeys to logger (#1128) by @hjgraca
  • feat(logging): add Enabled property to LogBuffering configuration (#1125) by @hjgraca

🐛 Bug and hot fixes

  • fix(logging): prevent stdout file descriptor leak in ConsoleWrapper (#1148) by @hjgraca
  • fix(idempotency): ensure unique idempotency keys for multiple methods with same key (#1124) by @hjgraca

🔧 Maintenance

This release was made possible by the following contributors:

@dependabot[bot], @dreamorosi, @hjgraca, @jihed-garaouch and dependabot[bot]