-
Notifications
You must be signed in to change notification settings - Fork 26
Bug: Tracing does not work with Top Level Lambda functions #735
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
Comments
@hjgraca - has your team been able to repro this issue? Our team is trying to use the Tracing tools in the PowerTools and this is currently blocking us. The convenience is great and I really do not want to start injecting DataDog dependencies and traces into the code. |
@nCubed - yes, we were able to reproduce the issue. Currently working on a fix, hope to get it out early next week. |
@nCubed - I am currently going over the code and everything seems to be fine. using System.Text.Json;
using Amazon.Lambda.Core;
using Amazon.Lambda.RuntimeSupport;
using Amazon.Lambda.Serialization.SystemTextJson;
using AWS.Lambda.Powertools.Tracing;
await LambdaBootstrapBuilder.Create((Func<string, ILambdaContext, Task<string>>)Handler, new DefaultLambdaJsonSerializer())
.Build()
.RunAsync();
[Tracing(SegmentName = "My Handler")]
async Task<string> Handler(string input, ILambdaContext context)
{
string json = await CreateAnonObjectAsJson(input);
return await Task.FromResult(json);
}
[Tracing(SegmentName = "My Mehod")]
async Task<string> CreateAnonObjectAsJson(string input)
{
var val = new
{
input,
utcDate = DateTime.UtcNow.ToString("s"),
date = DateTime.Now.ToString("s"),
};
string json = JsonSerializer.Serialize(val, new JsonSerializerOptions { WriteIndented = true });
return json;
} I will continue to investigate but I believe this will unblock you. |
@nCubed - As mentioned above the issue is with the string that gets generated from the top level statement handler. I am going to close this issue and open another issue that better reflects the issue we have, we are going to do two things, first add a summary to the SegmentName property that shows what are the accepted characters and also sanitize the string generated by the handler/methods were no SegmentName is defined. Thank you so much for reporting this, really appreciate your time. |
@hjgraca Thanks for the update. Been a busy last couple of days. I'll add named segments and give it a go next week. If possible, could you tag me in the work item addressing this issue so I can follow? |
@hjgraca - was able to verify the workaround with the segment names. Looks good. Looking forward to the new release. Thanks! |
Expected Behaviour
When using .net/C# Top Level Lambda functions, tracing, trace details should be available in AWS X-Ray traces console.
does not appear to be working.
Current Behaviour
When using .net/C# Top Level Lambda functions, tracing, trace details are not available in AWS X-Ray traces console.
Code snippet
Possible Solution
I suspect this may be related to a similar issue we found with Top Level statement functions and the logger. See #656
Steps to Reproduce
Run the sample, view the x-ray console, no tracing other than the standard traces exist.
Powertools for AWS Lambda (.NET) version
1.6.0
AWS Lambda function runtime
dotnet8
Debugging logs
The text was updated successfully, but these errors were encountered: