# .Net Core Agent not showing transactions

**URL:** <https://discuss.elastic.co/t/net-core-agent-not-showing-transactions/199129>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [September 11, 2019, 7:30pm UTC](https://discuss.elastic.co/t/net-core-agent-not-showing-transactions/199129 "2019-09-11T19:30:30Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![apm\_user](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/apm_user/32/46835_2.png) [@apm\_user](https://discuss.elastic.co/u/apm_user)\
**Post date:** [September 11, 2019, 7:30pm UTC](https://discuss.elastic.co/t/net-core-agent-not-showing-transactions/199129/1 "2019-09-11T19:30:30Z")

</div>

**Kibana version** :  
6..8.0

Hi,

I am trying to instrument a .net core web application using elastic and am running into some issues.  
I am able to see metric data ( cpu/ memory ) but am unable to see any transactions. I'm running a .NET Core 2.1 application on Ubuntu 18.04.

These are my settings

"ElasticAPM":{  
"ServerUrls" : "[https://apm-stage](https://apm-stage).\*\*\*\*.com:8200",  
"ServiceName": "dd\_dev",  
"MetricsInterval": "1s",  
"TransactionSampleRate": 1.0,  
"Environment": "staging"  
}

This is what I see when logs are turned on

{ "time": "2019-09-11 14:28:33.1157", "level": "DEBUG", "nested": { "message": "init main" } }  
{ "time": "2019-09-11 14:28:34.7749", "level": "WARN", "nested": { "message": "{MicrosoftExtensionsConfig} Service name provided in configuration is dd\_dev" }, "{Scope}": "MicrosoftExtensionsConfig", "ServiceName": "dd\_dev" }  
{ "time": "2019-09-11 14:28:34.7851", "level": "INFO", "nested": { "message": "{MicrosoftExtensionsConfig} The agent was started without a service version. The service version will be automatically discovered." }, "{Scope}": "MicrosoftExtensionsConfig" }  
{ "time": "2019-09-11 14:28:34.7851", "level": "INFO", "nested": { "message": "{MicrosoftExtensionsConfig} The agent was started without a service version. The automatically discovered service version is 1.0.0" }, "{Scope}": "MicrosoftExtensionsConfig", "ServiceVersion": "1.0.0" }  
{ "time": "2019-09-11 14:28:34.7910", "level": "DEBUG", "nested": { "message": "{Service} Environment.Version (`4.0.30319.42000') and version (`4.6.27317.03') from RuntimeInformation.FrameworkDescription (`.NET Core 4.6.27317.03') don't refer to the same version" }, "{Scope}": "Service", "DotNetFrameworkRuntimeVersion": "4.0.30319.42000", "DotNetFrameworkRuntimeDescription": ".NET Core 4.6.27317.03" } { "time": "2019-09-11 14:28:35.1437", "level": "DEBUG", "nested": { "message": "{Service} Falling back on using System assembly file location (`/home/deepak/dotnet/shared/Microsoft.NETCore.App/2.1.8/System.Private.CoreLib.dll') - returning (`2.1.8')" }, "{Scope}": "Service", "SystemAssemblyFileLocation": "\/home\/deepak\/dotnet\/shared\/Microsoft.NETCore.App\/2.1.8\/System.Private.CoreLib.dll", "DotNetFrameworkRuntimeVersion": "2.1.8" } { "time": "2019-09-11 14:28:35.1517", "level": "DEBUG", "nested": { "message": "{SystemInfoHelper} Could not parse container ID from '\/proc\/self\/cgroup' line: 10:memory:\/user.slice" }, "{Scope}": "SystemInfoHelper", "line": "10:memory:\/user.slice" } { "time": "2019-09-11 14:28:35.1517", "level": "DEBUG", "nested": { "message": "{SystemInfoHelper} Could not parse container ID from '\/proc\/self\/cgroup' line: 9:devices:\/user.slice" }, "{Scope}": "SystemInfoHelper", "line": "9:devices:\/user.slice" } { "time": "2019-09-11 14:28:35.1538", "level": "DEBUG", "nested": { "message": "{SystemInfoHelper} Could not parse container ID from '\/proc\/self\/cgroup' line: 7:pids:\/user.slice\/user-1000.slice\/session-2.scope" }, "{Scope}": "SystemInfoHelper", "line": "7:pids:\/user.slice\/user-1000.slice\/session-2.scope" } { "time": "2019-09-11 14:28:35.1538", "level": "DEBUG", "nested": { "message": "{SystemInfoHelper} Could not parse container ID from '\/proc\/self\/cgroup' line: 4:cpu,cpuacct:\/user.slice" }, "{Scope}": "SystemInfoHelper", "line": "4:cpu,cpuacct:\/user.slice" } { "time": "2019-09-11 14:28:35.1538", "level": "DEBUG", "nested": { "message": "{SystemInfoHelper} Could not parse container ID from '\/proc\/self\/cgroup' line: 2:blkio:\/user.slice" }, "{Scope}": "SystemInfoHelper", "line": "2:blkio:\/user.slice" } { "time": "2019-09-11 14:28:35.1538", "level": "DEBUG", "nested": { "message": "{SystemInfoHelper} Could not parse container ID from '\/proc\/self\/cgroup' line: 1:name=systemd:\/user.slice\/user-1000.slice\/session-2.scope" }, "{Scope}": "SystemInfoHelper", "line": "1:name=systemd:\/user.slice\/user-1000.slice\/session-2.scope" } { "time": "2019-09-11 14:28:35.1538", "level": "DEBUG", "nested": { "message": "{SystemInfoHelper} Could not parse container ID from '\/proc\/self\/cgroup' line: 0::\/user.slice\/user-1000.slice\/session-2.scope" }, "{Scope}": "SystemInfoHelper", "line": "0::\/user.slice\/user-1000.slice\/session-2.scope" } { "time": "2019-09-11 14:28:35.1538", "level": "ERROR", "nested": { "message": "{SystemInfoHelper} Failed parsing container id" }, "{Scope}": "SystemInfoHelper" } { "time": "2019-09-11 14:28:35.2948", "level": "INFO", "nested": { "message": "{MetricsCollector} Collecting metrics in 1000 milliseconds interval" }, "{Scope}": "MetricsCollector", "interval": 1000 } { "time": "2019-09-11 14:28:35.2986", "level": "DEBUG", "nested": { "message": "{MicrosoftExtensionsConfig} Using provided transaction sample rate`1' parsed as 1" }, "{Scope}": "MicrosoftExtensionsConfig", "ProvidedTransactionSampleRate": "1" }  
{ "time": "2019-09-11 14:28:35.4525", "level": "DEBUG", "nested": { "message": "{DiagnosticInitializer} Subscribed Elastic.Apm.AspNetCore.DiagnosticListener.AspNetCoreDiagnosticListener to `Microsoft.AspNetCore' events source" }, "{Scope}": "DiagnosticInitializer", "DiagnosticListenerType": "Elastic.Apm.AspNetCore.DiagnosticListener.AspNetCoreDiagnosticListener", "DiagnosticListenerName": "Microsoft.AspNetCore" }  
{ "time": "2019-09-11 14:28:36.3283", "level": "DEBUG", "nested": { "message": "{PayloadSenderV2} MetricSet added to the queue, Elastic.Apm.Metrics.MetricSet" }, "{Scope}": "PayloadSenderV2", "MetricSet": "Elastic.Apm.Metrics.MetricSet" }  
{ "time": "2019-09-11 14:28:36.3311", "level": "DEBUG", "nested": { "message": "{MetricsCollector} Metrics collected: MetricSample{system.memory.total: 33573797888}, MetricSample{system.memory.actual.free: 19184427008}, MetricSample{system.process.memory.size: 23259795456}, MetricSample{system.process.memory.rss.bytes: 90841088}, MetricSample{system.cpu.total.norm.pct: 0.149880095923261}, MetricSample{system.process.cpu.total.norm.pct: 0.0290689674819026}" }, "{Scope}": "MetricsCollector", "data": "MetricSample{system.memory.total: 33573797888}, MetricSample{system.memory.actual.free: 19184427008}, MetricSample{system.process.memory.size: 23259795456}, MetricSample{system.process.memory.rss.bytes: 90841088}, MetricSample{system.cpu.total.norm.pct: 0.149880095923261}, MetricSample{system.process.cpu.total.norm.pct: 0.0290689674819026}" }  
{ "time": "2019-09-11 14:28:37.3013", "level": "DEBUG", "nested": { "message": "{PayloadSenderV2} MetricSet added to the queue, Elastic.Apm.Metrics.MetricSet" }, "{Scope}": "PayloadSenderV2", "MetricSet": "Elastic.Apm.Metrics.MetricSet" }

Can you tell me why I'm unable to see transactions ?

Thanks.

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [September 11, 2019, 7:45pm UTC](https://discuss.elastic.co/t/net-core-agent-not-showing-transactions/199129/2 "2019-09-11T19:45:00Z")

</div>

Hi @apm_user, welcome to discuss!

Based on the logs you pasted here I don't see any transaction captured by the agent - so it seems to either go wrong very early, or capturing transactions is not turned on.

How did you activate the agent? Do you use the `UseAllElasticApm()` method as described [here](https://www.elastic.co/guide/en/apm/agent/dotnet/current/setup.html)?

---

<div class="post-metadata">

**Author:** ![apm\_user](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/apm_user/32/46835_2.png) [@apm\_user](https://discuss.elastic.co/u/apm_user)\
**Post date:** [September 11, 2019, 7:58pm UTC](https://discuss.elastic.co/t/net-core-agent-not-showing-transactions/199129/3 "2019-09-11T19:58:58Z")

</div>

I am using Elastic.Apm.AspNetCore and this is the code in Startup()

app.UseElasticApm(config);

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [September 11, 2019, 8:06pm UTC](https://discuss.elastic.co/t/net-core-agent-not-showing-transactions/199129/4 "2019-09-11T20:06:30Z")

</div>

> I am using Elastic.Apm.AspNetCore and this is the code in Startup()  
> app.UseElasticApm(config);

That seems ok, assuming it's in the 1. line of the `Configure` method.

One suggestion: Use the `UseAllElasticApm` from the `Elastic.Apm.NetCoreAll` package, that turns on every agent component, although `UseElasticApm` should also capture incoming HTTP request as transaction.

Just to make sure we are on the same page: with that the agent will capture the incoming HTTP request to your [ASP.NET](http://ASP.NET) Core app as transactions, for manually creating transactions you need to use the [public agent api](https://www.elastic.co/guide/en/apm/agent/dotnet/current/public-api.html).

Can you maybe also paste a log here where you turn both the [ASP.NET](http://ASP.NET) Core log level and the elastic apm log level to `Trace` and make sure that there are some HTTP requests in the timeframe of the logs?

---

<div class="post-metadata">

**Author:** ![apm\_user](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/apm_user/32/46835_2.png) [@apm\_user](https://discuss.elastic.co/u/apm_user)\
**Post date:** [September 11, 2019, 8:16pm UTC](https://discuss.elastic.co/t/net-core-agent-not-showing-transactions/199129/5 "2019-09-11T20:16:37Z")

</div>

@GregKalapos ,

I am able to see transactions,after moving up UseAllElasticAPM to line 1. Is there a reason it needs to be set before everything else ?

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [September 11, 2019, 8:39pm UTC](https://discuss.elastic.co/t/net-core-agent-not-showing-transactions/199129/6 "2019-09-11T20:39:28Z")

</div>

> I am able to see transactions,after moving up UseAllElasticAPM to line 1. Is there a reason it needs to be set before everything else ?

Glad to hear that! We recommend `UseAllElasticApm` being the 1. line because we want to make sure it's the 1 middleware that gets registered, otherwise the duration of the transaction can be inaccurate. On the other hand if it's not in the 1. line the agent still should record transactions, so that's strange. I opened a [GitHub issue](https://github.com/elastic/apm-agent-dotnet/issues/489) to investigate this further. If you have a small reproducer that would help a lot.

But overall I guess the problem is solved, right?

---

<div class="post-metadata">

**Author:** ![apm\_user](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/apm_user/32/46835_2.png) [@apm\_user](https://discuss.elastic.co/u/apm_user)\
**Post date:** [September 11, 2019, 8:45pm UTC](https://discuss.elastic.co/t/net-core-agent-not-showing-transactions/199129/7 "2019-09-11T20:45:04Z")

</div>

@GregKalapos ,

Yep, The problem is solved. Thanks for your help! Unfortunately, I don't have a small reproducer. I can post part of code of that helps.

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [September 11, 2019, 8:59pm UTC](https://discuss.elastic.co/t/net-core-agent-not-showing-transactions/199129/8 "2019-09-11T20:59:19Z")

</div>

Great!

Yes, if you could post part of the code that'd help. Either directly on the [GitHub issue](https://github.com/elastic/apm-agent-dotnet/issues/489) or here.

---

<div class="post-metadata">

**Author:** ![apm\_user](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/apm_user/32/46835_2.png) [@apm\_user](https://discuss.elastic.co/u/apm_user)\
**Post date:** [September 20, 2019, 8:00pm UTC](https://discuss.elastic.co/t/net-core-agent-not-showing-transactions/199129/9 "2019-09-20T20:00:57Z")

</div>

Sorry for the delay, Here is the code

```
 public void Configure Services(IServiceCollection service )
{
        services.AddMvcCore()
            .AddJsonFormatters()
            .AddApiExplorer()
            .AddJsonOptions(options => {
            options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
        });;

        services.Configure<ForwardedHeadersOptions>(options =>
        {
            options.ForwardedHeaders = 
                ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
        });
        
        
        services.AddSwaggerGen(c =>
        {
            c.SwaggerDoc("v1", new Info
            {
                Title = "example API",
                Version = "v1",
                Description = "Example",
                Contact = new Contact() { Name = "Distribution Developers", Email = "" }
            });

            c.ExampleFilters();
        });
       // Add Scoped and Singleton services here
      services.AddOptions();

```

}

public void Configure(IApplicationBuilder app,  
IHostingEnvironment env)  
{  
var config = new ConfigurationBuilder()  
.AddJsonFile("appsettings.json", false)  
.Build();

```
        app.UseForwardedHeaders();
        
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }

        var swaggerSettings = new SwaggerSettings();
        config.GetSection("Swagger").Bind(swaggerSettings);

        app.UseSwagger(c =>
        {
            c.PreSerializeFilters.Add((swagger, httpReq) => swagger.Host = httpReq.Host.Value);
            c.RouteTemplate = swaggerSettings.RouteTemplate;
        });

        app.UseSwaggerUI(c =>
        {
            c.RoutePrefix = swaggerSettings.RoutePrefix;
            c.SwaggerEndpoint(swaggerSettings.SwaggerEndpoint, "Characteristics API V1");
        });
        
        app.ConfigureExceptionHandler(_logger);

        app.UseMvc(routes =>
        {
            routes.MapRoute("default", "api/{controller=Home}/{action=Index}/{id?}");
        });

          app.UseAllElasticApm(config);
    }
```

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [September 20, 2019, 8:12pm UTC](https://discuss.elastic.co/t/net-core-agent-not-showing-transactions/199129/10 "2019-09-20T20:12:16Z")

</div>

Thanks @apm_user!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 11, 2019, 4:12pm UTC](https://discuss.elastic.co/t/net-core-agent-not-showing-transactions/199129/11 "2019-10-11T16:12:18Z")

</div>

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