No SQL/EF information

APM Agent language and version:
C#, 1.5.1


I'm trying to setup APM logging in a .NET Framework 4.8 application.
I'm getting some logging however the SQL and/or EF instrumentation doesn't seem to work.

I have added the elasticapm module in the web.config

  <remove name="ElasticApmModule"/>
  <add name="ElasticApmModule" type="Elastic.Apm.AspNetFullFramework.ElasticApmModule, Elastic.Apm.AspNetFullFramework" preCondition="managedHandler"/>
  <remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
  <remove name="OPTIONSVerbHandler"/>
  <remove name="TRACEVerbHandler"/>
  <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>


And I have added the EF interceptor

<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
    <parameter value="mssqllocaldb"/>
  <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
  <interceptor type="Elastic.Apm.EntityFramework6.Ef6Interceptor, Elastic.Apm.EntityFramework6"/>

And in global.asax I'm adding the SQL diagnostic subscriber

        protected void Application_Start()

        if (Agent.IsConfigured)
            Agent.Subscribe(new SqlClientDiagnosticSubscriber());

However the spans doesn't contain any SQL information.

Am I missing some configuration?

It seems the EF stuff is getting picked up but the code that uses a SQL Connection with dapper isn't showing up.


        using (IDbConnection connection = new SqlConnection(_connectionStringInsurance))
                list = connection
                        @"SELECT distinct Person.Id, Name Namn
                          FROM Person

However, the EF SQL stuff seems to show up twice. So is the entityframework and SQL diagnostics overlapping but yet the SQL diagnostics not working for the dapper code?

Hi @poserdonut,

we haven't tested SqlConnection with dapper, but I think it should not really make a difference, we capture DiagnosticSource or EventListener directly from System.Data.* or Microsoft.Data.* so our SqlClient auto instrumentation described here should work.

I think the easiest way to figure out what's going on would be to take a look at the agent logs. Could you maybe try to collect logs and paste them here? Here is a doc on how to do it.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.