End to end tracing is not shown

Kibana version: 7.11.2

Elasticsearch version: 7.11.2

APM Server version: 7.11.2

APM Agent language and version: Elastic.Apm.AspNetCore@1.10.0

Browser version: Chrome 91.0.4472.77

Original install method (e.g. download page, yum, deb, from source, etc.) and version:

Fresh install or upgraded from other version?

Fresh install

Is there anything special in your setup?

Default configurations.

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):

I have two dotnet webapi services. Service1 calls Service2 via REST using the default HttpClient. Both of the requests to individual services can be found from APM section of kibana. However, full trace is not shown for the first request. In other words, I can not see that Service1 called Service2 in the request lifecycle.




I am expecting the end to end trace of the original request like this one -

Steps to reproduce:

  1. Clone the git repository GitHub - feroz-ahmmed/elastic-apm-demo
  2. Set ElasticApm:ServerUrl and ElasticApm:SecretToken in the appsettings.json for both Service1 and Service2.
  3. Run both services.
  4. Send a Get request on /Service1 endpoint of Service1.
  5. Find the request in APM section of kibana.

Errors in browser console (if relevant):

Provide logs and/or server output (if relevant):

Replying so that this thread doesn't get closed.

Hi @feroz-ahmmed,

There's a couple of things that need to be addressed for this to work:

  1. The service name for TracingService2 should be TracingService2 (or something else, but different from TracingService1). It's set to the same service name as TracingService1 in the example:
  1. The APM agent is not configured to trace HTTP calls. The HttpDiagnosticsSubscriber needs to passed to app.UseElasticApm(Configuration, <subscribers here>) in at least TracingService1, though you probably want to trace HTTP calls in both services, so add it to both in

and

i.e.

app.UseElasticApm(Configuration, new HttpDiagnosticsSubscriber());

With these changes, distributed tracing works

If you want to let the APM agent configure all subscribers, you can reference the Elastic.Apm.NetCoreAll package, and call

app.UseAllElasticApm(Configuration);

which will subcribe HttpDiagnosticsSubscriber along with many others (see docs). For 1.11.0, these are

HI @forloop ,
Sorry for late reply. I tried your proposed changes changes and now I can see the end to end request trace.

Thanks for your time and detailed reply.