Auto instrumention - Metrics work, traces not received

It can sometimes come about very surreptitiously :smile:

For more context, the profiler injects a shim assembly that loads a supporting managed assembly containing the code for auto instrumentation. One of the first operations it does is to ensure the singleton agent instance is initialized:

In the case of .NET Framework running in a hosted environment e.g. IIS, it defers instantiation to the ASP.NET integration, which in turn, will end up instantiating the agent in the ElasticApmModule that it registers in the ASP.NET pipeline:

This is primarily done to allow the agent to be configured with ASP.NET specific components.

Now, if for some reason, you wanted to explicitly register ElasticApmModule yourself in web.config, and ultimately control the instantiation of the agent instead of leaving it to the profiler, you could as an alternative, disable the ASP.NET auto instrumentation integration with the Elastic APM profiler environment variable:

ELASTIC_APM_PROFILER_EXCLUDE_INTEGRATIONS=AspNet