Skip to content

Maintenance: Bring Amazon.XRay.Recorder.Core.Internal.Entities into PT Tracing #603

Open
@sliedig

Description

@sliedig

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 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.

Why is this needed?

It exposes the internals of Tracing utility.

Which area does this relate to?

Tracing

Solution

No response

Acknowledgment

Metadata

Metadata

Assignees

No one assigned

    Labels

    internalMaintenance changes

    Type

    No type

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions