# Traces are not correctly ccorrelated when using an API Gateway

**URL:** <https://discuss.elastic.co/t/traces-are-not-correctly-ccorrelated-when-using-an-api-gateway/348400>\
**Category:** APM\
**Tags:** open-telemetry\
**Created:** [December 1, 2023, 6:48am UTC](https://discuss.elastic.co/t/traces-are-not-correctly-ccorrelated-when-using-an-api-gateway/348400 "2023-12-01T06:48:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaxMeijer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/maxmeijer/32/128365_2.png) [@MaxMeijer](https://discuss.elastic.co/u/MaxMeijer)\
**Post date:** [December 1, 2023, 6:48am UTC](https://discuss.elastic.co/t/traces-are-not-correctly-ccorrelated-when-using-an-api-gateway/348400/1 "2023-12-01T06:48:21Z")

</div>

**Kibana version** :  
8.11.1

**Elasticsearch version** :  
8.11.1

**APM Server version** :  
Unknown/ most likely 8.11.1

**APM Agent language and version** :  
No APM Agent.  
.NET OpenTelemetry sending data directly to the APm server using OTLP protocol.

**Browser version** :  
N/A

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

**Fresh install or upgraded from other version?**  
N/A

**Is there anything special in your setup?** For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.  
Unknown  
N/A

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:  
Transactions are not correctly correlated across services when they communicate via an API gateway.

Given a setup where two services communicate via an API gateway, in this case Azure API Management. dependencies are not correctly correlated in the trace viewer in Kibana.

When Service A makes a call to Service B the result is that Service B is not shown as a dependency for Service A and the transaction from Service B is not correctly shown within the transaction from Service A. The following image shows the transactions and the details:

 ![apm_traces](https://us1.discourse-cdn.com/elastic/original/3X/3/f/3f032912601fe823c5145ecaf652703ab1e8c2cf.png)

As you can see the trace id in Service B is the same as the trace id in Service A but it is not correctly shown.

Is this a problem with OpenTelemetry, API Gateways or perhaps a combination of both?

The expected result is something as shown in the Kibana demo page where looking at the trace from Service A shows that the transaction goes to Service B

**Errors in browser console (if relevant)**:  
N/A

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

---

<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:** [December 29, 2023, 6:48am UTC](https://discuss.elastic.co/t/traces-are-not-correctly-ccorrelated-when-using-an-api-gateway/348400/2 "2023-12-29T06:48:25Z")

</div>

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