Skip to content

Conversation

hjgraca
Copy link
Contributor

@hjgraca hjgraca commented Sep 30, 2025

Please provide the issue number

Issue number: #1010

Summary

Changes

  • Fixed LitJson serialization crashes that were causing Lambda function failures when tracing complex objects

  • Resolved test isolation issues where environment variables from one test affected subsequent tests

  • XRayRecorder.cs: Added multi-layer sanitization with type conversion, property filtering, and fallback serialization

  • TracingSubsegment.cs: Enhanced subsegment lifecycle management with proper disposal patterns

  • Tracing.cs: Added new BeginSubsegment() API for manual subsegment creation

  • Enhanced Tracing API: Added Tracing.BeginSubsegment() method for manual subsegment management

User experience

You can create subsegments using the familiar using statement pattern for automatic cleanup and exception safety.

 using AWS.Lambda.Powertools.Tracing; public class Function { public async Task<APIGatewayProxyResponse> FunctionHandler (APIGatewayProxyRequest apigProxyEvent, ILambdaContext context) { using var gatewaySegment = Tracing.BeginSubsegment("PaymentGatewayIntegration"); gatewaySegment.AddAnnotation("Operation", "ProcessPayment"); gatewaySegment.AddAnnotation("PaymentMethod", "CreditCard"); var result = await ProcessPaymentAsync(); gatewaySegment.AddAnnotation("ProcessingTimeMs", result.ProcessingTimeMs); // Subsegment automatically ends when disposed } }

Checklist

Please leave checklist items unchecked if they do not apply to your change.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@boring-cyborg boring-cyborg bot added area/tracing Core tracing utility tests labels Sep 30, 2025
@pull-request-size pull-request-size bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 30, 2025
@boring-cyborg boring-cyborg bot added the documentation Improvements or additions to documentation label Sep 30, 2025
@github-actions github-actions bot added the internal Maintenance changes label Sep 30, 2025
@hjgraca hjgraca self-assigned this Sep 30, 2025
@hjgraca hjgraca linked an issue Sep 30, 2025 that may be closed by this pull request
2 tasks
Copy link

codecov bot commented Sep 30, 2025

Codecov Report

❌ Patch coverage is 84.94624% with 56 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.12%. Comparing base (5661621) to head (f5485a1).
⚠️ Report is 11 commits behind head on develop.

Files with missing lines Patch % Lines
...Lambda.Powertools.Tracing/Internal/XRayRecorder.cs 83.01% 41 Missing and 12 partials ⚠️
...a.Powertools.Tracing/Internal/TracingSubsegment.cs 92.50% 3 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@ ## develop #1011 +/- ## =========================================== + Coverage 77.89% 78.12% +0.22%  =========================================== Files 298 298 Lines 12079 12003 -76 Branches 1457 1441 -16 =========================================== - Hits 9409 9377 -32  + Misses 2198 2163 -35  + Partials 472 463 -9 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
@hjgraca hjgraca marked this pull request as draft September 30, 2025 15:13
@hjgraca hjgraca marked this pull request as ready for review October 1, 2025 09:18
@leandrodamascena
Copy link
Contributor

I'll review this by EOD

@leandrodamascena
Copy link
Contributor

Member

I didn't have time to review this last week, but expect to complete it by EOW.

@hjgraca hjgraca merged commit 3a6cf65 into develop Oct 7, 2025
10 checks passed
@hjgraca hjgraca deleted the feature/tracing-sanitize-metadata branch October 7, 2025 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tracing Core tracing utility documentation Improvements or additions to documentation internal Maintenance changes size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. tests
2 participants