question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Datadog.Trace.Annotations doesn't seem to work with AWS Lambda functions

See original GitHub issue

Describe 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 Screenshot 2023-05-23 at 13 39 56 (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:closed
  • Created 4 months ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
joeyzhao2018commented, Jun 2, 2023

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 soon

1reaction
joeyzhao2018commented, Jun 2, 2023

Hi @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. Screenshot 2023-06-01 at 10 59 54 PM Screenshot 2023-06-01 at 11 05 05 PM

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 its dd-trace-dotnet-ARM and the version is 8.

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found