Elastic APM .net agent is not instrumenting methods

Kibana 7.4.0:

Elasticsearch 7.4.0:

APM Server version 7.6.2:

**APM Agent language and version **:

Chrome 80:

Original install method from download page 64bit .net agent:

**Fresh install **

Hi,

I just set up Elastic APM .Net agent, I have Asp.net core web api project, I used below configuration in my startup file to configure the APM, now it is sending the data to APM.

using Elastic.Apm.NetCoreAll;

 app.UseAllElasticApm(Configuration);

my problem is I am only seeing Http top level requests as If I am seeing in Chrome network tab, selecting each http request is not drilling down to method calls and time it took to start and and the method and follow the call stack. I am looking here .Net code method instrumentation also under the http web api call. Please advice if there is anything I am missing.

below is how it looks no further breaking down, I would like to drill down further into each and everymethod, please advise if we can achieve this or not.

Hi @ramkms6666,

this post on stackoverflow explains this - in that question an ASP.NET MVC app is mentioned, but the answer is the same here.

hey thanks Greg for replying.., so that means if not http calls, we have to go for manual instrumentation, which is very tedious process, when will the complete flow is instrumented.., I mean all the method calls, irrespective of http calls or sql client calls?.., any idea?

so that means if not http calls, we have to go for manual instrumentation

Correct.

When will the complete flow is instrumented.., I mean all the method calls, irrespective of http calls or sql client calls?

We don't really aim for that - that would mean an overhead that would be very likely unacceptable for most of the users in production. Also including app and framework methods would lead to a UI that is very hard to understand even with a simple application.

What we already do is that for each span that is created we capture a callstack depending on the duration of the span. Here is the setting to change the duration limit for call stack capturing.

With that you'll see the callstack on every span like this (this is the same for every span - not matter what it captures):

If you set SpanFramesMinDuration to negative value you'll have the callstack for every single span - keep in mind this will still cause some overhead.

With that hopefully you'll get what you aim for - so you could strategically place some code and manually capture spans and for those spans you can get the callstack - but instrumenting every single method is not a recommended way.

Instrumenting every method is still a nice things can be kept as opt in.. by way of configuring based on the envioronment, for eg Development environment I don't want to touch the code and would like to see how much each method is taking time.., for production I would choose to turn off this option and it will fall back to http and database calls.

Also I have one more thing.., I added these lines

var transaction = Elastic.Apm.Agent.Tracer.StartTransaction("method A",  Elastic.Apm.Api.ApiConstants.ActionExec);

transaction.End();

in my begin and end of a method A, if method A calls method B, and If I add in method B also above lines , this is writing like a flat structure in APM, I would want to see going like a tree structure.., meaning should show A time clicking on it should expand B time etc.

also I had the following configuration in my appsettings.json

"ElasticApm": {
    "SecretToken": "",
    "ServerUrls": "http://localhost:8200", 
    "ServiceName" : "CusotmerService",
    "StackTraceLimit" : -1,
    "SpanFramesMinDuration":5,
    "TransactionSampleRate": 1.0
  }

I don't see call stack or span is coming for any service call, is there any thing I am missing. Please suggest.

@ramkms6666 that line creates a transaction - you need to create a span for this - use the StartSpan method for that on the transaction.

You can read our docs to learn more about the terminology on this.

really callstack is not helping, I am looking from the point of instrumenting everything.., thanks for your help.

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