Datadog.Trace.Annotations doesn't seem to work with AWS Lambda functions
See original GitHub issueDescribe the bug
We’re using the Datadog.Trace.Annotations
-package to trace a method called by the lambda handler, but, the traces never seems to show up in Datadog. Using the Datadog.Trace
-package works as expected.
To Reproduce
[Trace(OperationName = "example.do-heavy-thinking", ResourceName = "Example.Think")] // This trace never shows up
private async Task Think()
{
using (var scope = Tracer.Instance.StartActive("example.do-heavy-thinking-in-scope")) // This trace does
{
scope.Span.ResourceName = "Example.ThinkInScope";
var random = new Random();
var thinkingTime = random.Next(50, 1000);
scope.Span.SetTag("thinking.time", $"{thinkingTime}ms");
Logger.LogInformation($"Need to think for {thinkingTime}ms");
await Task.Delay(thinkingTime);
}
}
The source code for the project can be found here and the function where the method above is invoked here.
Expected behavior That both traces in the above example would be sent to Datadog.
Screenshots (All traces visible in Datadog)
Runtime environment (please complete the following information):
- Instrumentation mode: Automatic (through Serverless Framework plugin)
- Tracer version: 2.30.0 (1.0.0 for Annotations package)
- OS: Amazon Linux 2 (arm64)
- CLR: .NET Core 6.0
Additional context
The infrastructure is deployed using Serverless Framework and the serverless-plugin-datadog
is used to instrument the Lambda. Using the default values for the configuration of the plugin.
Issue Analytics
- State:
- Created 4 months ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Distributed Tracing with AWS Lambda Serverless ...
The Datadog Python, Node.js, Ruby, Go, Java, and .NET tracing libraries support distributed tracing for AWS Lambda. You can install the tracer using...
Read more >Troubleshoot AWS Lambda Monitoring
Use the Serverless Flare command from the root of your project directory to automatically collect and submit data about your Lambda function to...
Read more >Configure Serverless Monitoring for AWS Lambda
First, install Datadog Serverless Monitoring to begin collecting metrics, traces, and logs. After installation is complete, refer to the following topics to ...
Read more >AWS Lambda
Once this is completed, view all of your Lambda Functions in the Datadog Serverless view. This page brings together metrics, traces, and logs...
Read more >Enabling ASM for AWS Lambda
The Datadog Serverless Framework plugin automatically configures your functions to send metrics, traces, and logs to Datadog through the Datadog Lambda ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @ganhammar, serverless-plugin-datadog v5.33.0 just got released. It should point to dd-trace-dotnet-ARM v8.
I need to take a closer look at the issue why the
aws.lambda
is missing in example2. I will keep this issue open for now and update here soonHi @ganhammar, I have deployed and tested using the code your provided. I believe they work in both example and Example2. Thank you again for providing a clean example. I really appreciate it.
As @hghotra has pointed out, there’s some delay between the layer release and the serverless framework plugin release this time. I’ll try to update the plugin tomorrow and update here once done. Meanwhile, if you want to manually fix it. The working layer should be :
arn:aws:lambda:<AWS-REGION>:464622532012:layer:dd-trace-dotnet-ARM:8
Note that itsdd-trace-dotnet-ARM
and the version is 8.