Skip to content
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

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

Open
1 task done
sliedig opened this issue Jul 1, 2024 · 0 comments
Open
1 task done
Labels
internal Maintenance changes

Comments

@sliedig
Copy link
Contributor

sliedig commented Jul 1, 2024

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

@sliedig sliedig added internal Maintenance changes triage Pending triage from maintainers labels Jul 1, 2024
@hjgraca hjgraca removed the triage Pending triage from maintainers label Jul 9, 2024
@hjgraca hjgraca moved this to 📋 Backlog in Powertools for AWS Lambda (.NET) Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Maintenance changes
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants