When creating an trace inside a method using Tracing's WithSubsegment method, the action requires no additional imports are required for a file, just the reference to AWS.Lambda.Powertools.Tracing.
using AWS.Lambda.Powertools.Tracing;
...
Tracing.WithSubsegment("SendGrid", async s =>
{
var response = await client.SendEmailAsync(msg);
Logger.LogInformation(response.StatusCode);
if (response.StatusCode == HttpStatusCode.Accepted)
{
nextExam.NotificationSent = true;
}
});
however, if this call is refactored to use a local function for example, all of a sudden you need to ing a using reference to Amazon.XRay.Recorder.Core.Internal.Entities:
using AWS.Lambda.Powertools.Tracing;
using Amazon.XRay.Recorder.Core.Internal.Entities;
...
async void Subsegment(Subsegment subsegment)
{
var response = await client.SendEmailAsync(msg);
Logger.LogInformation(response.StatusCode);
if (response.StatusCode == HttpStatusCode.Accepted)
{
nextExam.NotificationSent = true;
}
}
Tracing.WithSubsegment("SendGrid", Subsegment);
This causes some confusion since the X-Ray libraries are included with PT. Ideally, we would want to hide this implementation also and bring Amazon.XRay.Recorder.Core.Internal.Entities under Powertools.
Summary
When creating an trace inside a method using Tracing's
WithSubsegment
method, the action requires no additional imports are required for a file, just the reference toAWS.Lambda.Powertools.Tracing
.however, if this call is refactored to use a local function for example, all of a sudden you need to ing a using reference to
Amazon.XRay.Recorder.Core.Internal.Entities
:This causes some confusion since the X-Ray libraries are included with PT. Ideally, we would want to hide this implementation also and bring Amazon.XRay.Recorder.Core.Internal.Entities under Powertools.
Why is this needed?
It exposes the internals of Tracing utility.
Which area does this relate to?
Tracing
Solution
No response
Acknowledgment