Setup Elastic Apm .Net Agent with .Net Core 3 Console Application

Kibana version:
7.10
Elasticsearch version:
7.10
APM Server version:
7.10
APM Agent language and version:
.Net 1.7.0
Browser version:

Original install method (e.g. download page, yum, deb, from source, etc.) and version:

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):

In a .Net Core 3 Console Application using IHostBuilder I added the call to UseAllElasticApm. This configures the all the necessary DI components and I can use ITracer to create transactions and spans. However no database calls, SqlProvider spans are collected.

If I add the following code after UseAllElasticApm then the information is collected, am I missing anything in the original setup. I would think you would just need the original UseAllElasticApm.

public static void SetupElasticApm(this IServiceProvider sp)
    {
        if (!Agent.IsConfigured)
        {
            Agent.Setup(sp.GetRequiredService<AgentComponents>());
            Agent.Subscribe(new EfCoreDiagnosticsSubscriber(),
                            new SqlClientDiagnosticSubscriber());
        }
    }

Steps to reproduce:
I can create a repro if needed, but thought I would post just in case I am missing something obvious. Thanks for all your great work on the APM!

Here is a sample repo - https://github.com/rabberbock/SampleApm

Thanks for reporting this @rainbowkid11.

This seems to be a bug and I just opened a Pull Request to fix it.

For now, I think the only option is to keep your workaround. Once the fix is out, you can remove that. The problem was very likely not in your code.

Sorry about the trouble.

Awesome, thanks!

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