Elastic APM for .net giving intermittent trace details


I am using zero code changes method for instrumenting my .net5/.netcore3.1 version applications with Elastic APM which uses the startuphook.dll
While observing some traces for same transaction performed in a time gap of around 5 mins it is been seen that I do not get the entire stack trace.

To elaborate more on this attaching screenshot of the traces I received for a delete transaction I performed.

Please find below details for the same:

This is the homepage of my application wherein the scenario is to insert a record and then delete the inserted record

Below is the stack trace which is the correct and the required one.

But if I perform the same transaction within a time gap of 5 minutes or even more, I do not get the exact traces.

For example the below ones :

Received only 1 query in the trace details of the same scenario performed

The traces I receive for the same transaction seems to be intermittent. Can anyone please provide suggestions /advise on the same to mitigate the issue.

My sample application uses PostgreSQL with package reference for the same as Npgsql.EntityFrameworkCore.PostgreSQL version 3.1.3

Thanks in advance.

Hi @Namita_Jaokar

what the agent captures there in this case are the database statements. You say you use Npgsql.EntityFrameworkCore.PostgreSQL - which means the application does not create the SQL statements directly, instead it relies on Entity Framework Core, which generates the database statements. It's an Object relational mapping framework which takes care of translating tables and rows from your database into .NET objects.

I think it's normal and expected that Entity Framework Core creates different database statements based on the current state of the database, your app, and things that EF already fetched.

So to me this looks like an expected behaviour - this is how an ORM works. If you'd have hard coded database calls with hard coded SQL statements, then you'd have the same spans, but that's not the case here from what I see.

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