generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 33
Labels
bugUnexpected, reproducible and unintended software behaviourUnexpected, reproducible and unintended software behaviour
Description
Expected Behaviour
Should allow to create subsegments when using Fluent API
This is a regression
Tracing.WithSubsegment("LoggingResponse",
subsegment =>
{
subsegment.AddAnnotation("AccountId", apigwProxyEvent.RequestContext.AccountId);
subsegment.AddMetadata("LookupRecord", lookupRecord);
});
Current Behaviour
After introducing a new way of setting subsegments the old way started failing with System.NullReferenceException: Object reference not set to an instance of an object.
This was caused when using Fluent API
Tracing.WithSubsegment("LoggingResponse",
subsegment =>
{
subsegment.AddAnnotation("AccountId", apigwProxyEvent.RequestContext.AccountId);
subsegment.AddMetadata("LookupRecord", lookupRecord);
});
the new version works as expected
using var gatewaySegment = Tracing.BeginSubsegment("LoggingResponse");
gatewaySegment.AddAnnotation("AccountId", apigwProxyEvent.RequestContext.AccountId);
gatewaySegment.AddMetadata("LookupRecord", lookupRecord);
Code snippet
Tracing.WithSubsegment("LoggingResponse",
subsegment =>
{
subsegment.AddAnnotation("AccountId", apigwProxyEvent.RequestContext.AccountId);
subsegment.AddMetadata("LookupRecord", lookupRecord);
});
Possible Solution
No response
Steps to Reproduce
add code
Tracing.WithSubsegment("LoggingResponse",
subsegment =>
{
subsegment.AddAnnotation("AccountId", apigwProxyEvent.RequestContext.AccountId);
subsegment.AddMetadata("LookupRecord", lookupRecord);
});
Powertools for AWS Lambda (.NET) version
latest
AWS Lambda function runtime
dotnet8
Debugging logs
System.NullReferenceException: Object reference not set to an instance of an object.
Metadata
Metadata
Assignees
Labels
bugUnexpected, reproducible and unintended software behaviourUnexpected, reproducible and unintended software behaviour
Type
Projects
Status
👀 In review