dd-trace-dotnet icon indicating copy to clipboard operation
dd-trace-dotnet copied to clipboard

Attach origin of a Db Query to a Span

Open lippinio opened this issue 3 years ago • 4 comments

For a given Trace its really hard to find out where the query is located in the Code. Its even harder to find when an OR Mapper is used like EF Core

So for spans with a Database Query it would be very helpful to see the origin of the query. We imagine something like Filename and Line Number in the Code as Tags on Database Queries. A similar feature is described here for EF Core: https://github.com/dotnet/efcore/issues/14176

For EF Core there is a Feature thats called TagWith() thats add a given Comment to a Query. But as i know Comments are dropped by datadog. https://docs.microsoft.com/en-us/ef/core/querying/tags

lippinio avatar Apr 22 '21 06:04 lippinio

EfCore merged the feature to TagWith Feature ... would be cool to look into this.

tobiagru avatar May 27 '21 12:05 tobiagru

Any news on this topic?

lippinio avatar Oct 27 '21 14:10 lippinio

+1

mlstubblefield avatar Jul 27 '22 16:07 mlstubblefield

The Continuous Profiler for .NET just reached General Availability (GA) with yesterday's 2.14.0 release. The Continuous Profiler can help you find where your database queries are coming from since it can track entire stack traces and connect those to your APM traces. See the section "Connect traces to profiling data" in the documentation linked above.

Another related Datadog feature is the Source Code Integration, which lets Datadog show snippets of your source code inline with APM traces and other products. However, today source code integration only supports Go and JVM languages, not .NET yet.

lucaspimentel avatar Aug 24 '22 18:08 lucaspimentel