Get stack Trace details for netcore3.1 net5 version applications with Elastic APM

Hi ,

I am using Elastic APM for dotnet application-(MVC model) and following the zero code set up method to configure my dotnet application with elastic apm agent.
I am unable to view the end to end flow of the api call i.e. I need to capture the classes and methods that triggered the db statement. But I can only find the Entityframeworkcore libraries .dll calls in the stack trace.
My application is using Entityframeworkcore migrations with PostgreSQL.

Could you please help me with getting the classes and method that triggers the query in the stack trace.
Below is the sample result for the api call

Adding the stack trace received for the above query as well.

Elastic.Apm.Model.Span in .ctor in C:\Users\jenkins\workspace\net_apm-agent-dotnet-mbp_PR-1650\apm-agent-dotnet\src\Elastic.Apm\Model\Span.cs at line 114

Elastic.Apm.Model.Transaction in StartSpanInternal in C:\Users\jenkins\workspace\net_apm-agent-dotnet-mbp_PR-1650\apm-agent-dotnet\src\Elastic.Apm\Model\Transaction.cs at line 653

Elastic.Apm.Model.ExecutionSegmentCommon in StartSpanOnCurrentExecutionSegment in C:\Users\jenkins\workspace\net_apm-agent-dotnet-mbp_PR-1650\apm-agent-dotnet\src\Elastic.Apm\Model\ExecutionSegmentCommon.cs at line 307

Elastic.Apm.Model.DbSpanCommon in StartSpan in C:\Users\jenkins\workspace\net_apm-agent-dotnet-mbp_PR-1650\apm-agent-dotnet\src\Elastic.Apm\Model\DbSpanCommon.cs at line 32

Elastic.Apm.EntityFrameworkCore.EfCoreDiagnosticListener in HandleOnNext in C:\Users\jenkins\workspace\net_apm-agent-dotnet-mbp_PR-1650\apm-agent-dotnet\src\Elastic.Apm.EntityFrameworkCore\EfCoreDiagnosticListener.cs at line 40

Elastic.Apm.DiagnosticListeners.DiagnosticListenerBase in OnNext in C:\Users\jenkins\workspace\net_apm-agent-dotnet-mbp_PR-1650\apm-agent-dotnet\src\Elastic.Apm\DiagnosticListeners\DiagnosticListenerBase.cs at line 53

System.Diagnostics.DiagnosticListener in Write in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

Microsoft.EntityFrameworkCore.Diagnostics.RelationalLoggerExtensions in BroadcastCommandExecuting in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

Microsoft.EntityFrameworkCore.Diagnostics.RelationalLoggerExtensions in CommandReaderExecutingAsync in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

Microsoft.EntityFrameworkCore.Storage.RelationalCommand+d__17 in ExecuteReaderAsync in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1 in ExecutionContextCallback in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1 in MoveNext x 1 in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Threading.Tasks.AwaitTaskContinuation in RunOrScheduleAction in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Threading.Tasks.Task in RunContinuations in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Threading.Tasks.Task`1 in TrySetResult in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 in SetExistingTaskResult in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 in SetResult in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

Microsoft.EntityFrameworkCore.Storage.RelationalConnection+d__54 in OpenAsync in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1 in ExecutionContextCallback in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1 in MoveNext x 1 in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Threading.Tasks.AwaitTaskContinuation in RunOrScheduleAction in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Threading.Tasks.Task in RunContinuations in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Threading.Tasks.Task`1 in TrySetResult in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 in SetExistingTaskResult in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Runtime.CompilerServices.AsyncTaskMethodBuilder in SetResult in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

Microsoft.EntityFrameworkCore.Storage.RelationalConnection+d__58 in OpenInternalAsync in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1 in ExecutionContextCallback in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1 in MoveNext x 1 in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Threading.Tasks.AwaitTaskContinuation in RunOrScheduleAction in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Threading.Tasks.Task in RunContinuations in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Threading.Tasks.Task`1 in TrySetResult in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 in SetExistingTaskResult in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Runtime.CompilerServices.AsyncTaskMethodBuilder in SetResult in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

Npgsql.NpgsqlConnection+<>c__DisplayClass41_0+<g__OpenAsync|0>d in g__OpenAsync|0 in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1 in ExecutionContextCallback in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1 in MoveNext x 1 in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Threading.Tasks.AwaitTaskContinuation in RunOrScheduleAction in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Threading.Tasks.Task in RunContinuations in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Threading.Tasks.Task`1 in TrySetResult in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 in SetExistingTaskResult in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder`1 in SetResult in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

Npgsql.ConnectorPool+<>c__DisplayClass38_0+<g__RentAsync|0>d in g__RentAsync|0 in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1 in ExecutionContextCallback in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox1 in MoveNext x 1 in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Threading.Tasks.AwaitTaskContinuation in RunOrScheduleAction in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Threading.Tasks.Task in RunContinuations in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Threading.Tasks.Task`1 in TrySetResult in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 in SetExistingTaskResult in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder`1 in SetResult in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

Npgsql.ConnectorPool+d__41 in OpenNewConnector in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.15\System.Private.CoreLib.dll

Thanks in Advance.

Hi @Namita_Jaokar,

it seems you hit the default stack trace limit which is 50. By default the agent only sends 50 stack frames in each stack trace, if you have more, they'll be cut.

You can increase this limit by changing the StackTraceLimit config to a higher number. The documentation about it can be found here.

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