-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Batch Processing breaks Tracing #630
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
I have created this MVP sample repository to demonstrate the issue. The code is pretty simple, but is throwing the exception noted above. What am I doing wrong, or is this a bug? https://github.com/CoreySchnedl/dotnet-powertools-issue-630-sample |
Hi @CoreySchnedl! Thank you for opening this issue and providing a small project to reproduce the bug, that is really helpful! We will work on reproducing the bug this week and see if we need to create a bugfix to resolve this issue or if there is something we can change in this project that will fix the problem. We will update this issue as soon as we have more information. |
Hi @CoreySchnedl as a workaround while we do a release to fix this bug, if you are not using the Metadata in X-Ray you could change the Another approach if you don't want to lose the Metadata from other methods that have the public class CustomSqsRecordHandler : ISqsRecordHandler
{
// [Tracing] -- remove the decorator
public async Task<RecordHandlerResult> HandleAsync(SQSEvent.SQSMessage record, CancellationToken cancellationToken)
{
/*
* Your business logic.
* If an exception is thrown, the item will be marked as a partial batch item failure.
*/
Logger.LogInformation($"Handling SQS record with message id: '{record.MessageId}'.");
Logger.LogInformation($"Handling record with body: {record.Body}");
var product = JsonSerializer.Deserialize<Product>(record.Body);
Tracing.WithSubsegment("Custom Record Handler", (subsegment) =>
{
// if you uncomment this line you will see that it will fail
// subsegment.AddMetadata("Data", RecordHandlerResult.FromData(product));
SomeCoolFunction();
SomeCoolFunction();
});
Logger.LogInformation($"Handling product with id: {product!.SomeCoolField}");
return await Task.FromResult(RecordHandlerResult.FromData(product));
}
[Tracing]
private static bool SomeCoolFunction()
{
return true;
}
} |
Release 1.13 |
Expected Behaviour
Tracing show show segments within x-ray when the batch processing utility is used.
I am unable to get Tracing to work (previously worked fine before converting to using the Batch Processing Powertools functionality).
Current Behaviour
Receiving this error on invocation:
Code snippet
The text was updated successfully, but these errors were encountered: