No SQL tracing for .net 5

Hi,

Basically I'm experiecing the same issue as described here:

Which should be fixed here:

However, I still don't have any traces for any SQL transaction.

Our API is running .NET 5 (inside kubernetes).
Elastic.Apm.NetCoreAll is version 1.10.0

Setup code in Startup.cs

        Environment.SetEnvironmentVariable("ELASTIC_APM_ENVIRONMENT", Configuration.Instance.Environment);
        Environment.SetEnvironmentVariable("ELASTIC_APM_SERVICE_NAME", "authentication-api");
        Environment.SetEnvironmentVariable("ELASTIC_APM_SECRET_TOKEN", "XXXX");
        Environment.SetEnvironmentVariable("ELASTIC_APM_SERVER_URL", "some-url");
        app.UseAllElasticApm();

Am I missing something, or is this still a bug?

Thanks,
Danny

Hi @Danny_Stommen,

the bug should be fixed and included in version 1.10.0 (which is the one you use). We have tests covering .NET 5, so I think the original issue you linked is fixed.

To better troubleshoot this, maybe a few questions:

  • The problem is that you don't see spans for the SQL queries, right? So there is no sign of the SQL call in the trace? Or are there SQL spans, but some info is missing?
  • How are your SQL queries generated? You use things like SqlCommand directly (like here), or is it Entity Framework (Core), or some other thing? What I want to get to with this question is that maybe you use something that we currently don't support. Here is a list of DB libraries the agent monitors.

Hi Greg,

The problem is that you don't see spans for the SQL queries, right?
Exactly! So basically we have gaps in our tracing timelines.

The problem is that you don't see spans for the SQL queries, right?
We're using Dapper.net. For example:

      using var connection = await _MySqlConnectionFactory.CreateConnectionAsync();
      string statement = "SELECT * FROM some-table";
      
      var result = await connection.QueryAsync<SomeModel>(statement);

I believe Dapper is using DbCommand under the hood.

Are you using a MySQL ADO.NET provider?

Implementation of the CreateConnectionAsync is this one:

public async Task<IDbConnection> CreateConnectionAsync() {
  var connection = new MySql.Data.MySqlClient.MySqlConnection(GetConnectionString());
  await connection.OpenAsync();

  return connection;
}

Where MySql.Data.MySqlClient.MySqlConnection comes from the MySql.Data nuget package

Thanks for the confirmation. Currently, there's no auto instrumentation for MySQL with the .NET agent; There's an open issue to track it:

1 Like

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