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.

Elastic.Apm.AspNetFullFramework not showing database calls

See original GitHub issue

Only the HTTP calls are shown in Kibana in the Trace sample, there is nothing on database calls There is nothing in the documentation specific to database queries interception for the full .net framework - https://www.elastic.co/guide/en/apm/agent/dotnet/current/setup.html#setup-asp-net

Steps to reproduce the behavior:

  1. Create a new project ASP.NET Web Application (.NET Framework) with MVC and add the Elastic.Apm.AspNetFullFramework nugget (1.2)
  2. Web.config:
<appSettings>
    <add key="ElasticApm:ServerUrls" value="http://IP.ADDR:8200/" />
  </appSettings>
    <modules>
      <add name="ElasticApmModule" type="Elastic.Apm.AspNetFullFramework.ElasticApmModule, Elastic.Apm.AspNetFullFramework" />
    </modules>
  1. Execute any type of query using System.Data.SqlClient, for example

  2. See the output in Kibana - only HTTP call is shown

Expected behavior Trace sample to include SQL calls as well.

kibana

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:28 (15 by maintainers)

github_iconTop GitHub Comments

3reactions
gregkalaposcommented, Jan 21, 2020

Great! Then this is something that we almost already support.

So, there is no official NuGet package, but we have this project in the repo: https://github.com/elastic/apm-agent-dotnet/tree/master/src/Elastic.Apm.SqlClient

That is the auto instrumentation for SqlClient - meaning db calls will be automatically captured for you.

If you clone the repo and build that project you can create an assembly from that.

That will give you a SqlClientDiagnosticSubscriber() class.

After that, all you need to do is to execute this once, preferably during the startup of the application:

Agent.Subscribe(new SqlClientDiagnosticSubscriber());

This way you can give it a try.

But please keep in mind this is not an officially released component yet.

The main reason it’s not yet released is because we don’t have a solution for scenarios when EF or EF Core is used with MSSql - in that case EF (Core) uses SqlClient internally, so db calls would be captured twice. Which in your case is not relevant, so that’s good.

Once we have a solution for this problem, the plan is to have an official release of this package.

2reactions
vhatsuracommented, Jan 22, 2020

@vhatsura appreciate all your help here! Even if it’s mostly brainstorming and ideas, the Elastic team could still benefit from all the research we’ve done so far.

I totally agree with you. My mention was related to not retranslate my words on behalf of the owners.

NET45 referencing .net core System.Net.Http supports diagnostic listener

So, this mention is related to the case, when you reference .net core System.Net.Http as a NuGet package in .Net Framework application. To be honest, DiagnosticsSource is available for .Net Framework as a NuGet package. However, .Net Framework version of SqlClient, don’t spread trace events through DiagnosticsSource.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting | APM .NET Agent Reference [1.x]
No data is sent to the APM Serveredit. If neither errors nor performance metrics are being sent to the APM Server, it's a...
Read more >
Elastic APM auto instrumentation not capturing DB and http ...
I've created a test project with a .NET WCF service (Framework 4.7.1), I can see the ElasticAPM agent auto creates spans for WCF...
Read more >
Common problems | APM User Guide [8.9]
Data is indexed but doesn't appear in the APM appedit ... The APM app relies on index mappings to query and display data....
Read more >
Cannot make APM Client work on IIS
Hi Sergey, thanks for the quick answer. Adding the type "Elastic.Apm.AspNetFullFramework" fixed the problem. I'm not getting data in the server, ...
Read more >
Auto instrumention - Metrics work, traces not received - APM
We want to trace all of our applications (built with OutSystems lowcode platform). So we used the auto instrumentation profiler for IIS 10.0 ......
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