# Service Map showing duplicate Connection between two services

**URL:** <https://discuss.elastic.co/t/service-map-showing-duplicate-connection-between-two-services/377988>\
**Category:** Kibana\
**Created:** [May 9, 2025, 11:26am UTC](https://discuss.elastic.co/t/service-map-showing-duplicate-connection-between-two-services/377988 "2025-05-09T11:26:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aritra\_Dutta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aritra_dutta/32/142285_2.png) [@Aritra\_Dutta](https://discuss.elastic.co/u/Aritra_Dutta)\
**Post date:** [May 9, 2025, 11:26am UTC](https://discuss.elastic.co/t/service-map-showing-duplicate-connection-between-two-services/377988/1 "2025-05-09T11:26:01Z")

</div>

**version: v8.17.3**

**setup**  
Deployed on elastic cloud  
Services deployed on Kubernetes  
Services instrumented with Opentelemetry Go Agent and kotel package (comes with frankz-go)  
Services Communicate via Redpanda (Kafka compatible)

On Producing service side,  
the producer is auto-instrumented using `"github.com/twmb/franz-go/plugin/kotel"`  
`kgo.WithHooks(kotelService.Hooks()...)` where kotelService is simply `*kotel.Kotel`

This correctly adds the required headers on the produced records.

On consumer side,  
consumer is also auto instrumented in the same way. In addition, after consuming a record I have `ctx, span := KotelTracer.WithProcessSpan(record)` where `KotelTracer` is simply `*kotel.Tracer` and `record` is a `*kgo.Record`. This `ctx` is used for rest of processing.

**Description of the problem** :

In transaction section on kibana,  
I can see distributed tracing as expected with correct trace header propagation.  
But on service Map I can see 2 different types of Connection.

1. Service-A -\> Redpanda Topic -\> Service-B
2. Service-A -\> Service-B

**expected Behaviour**  
Service-A -\> Redpanda Topic -\> Service-B

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/2/d26fe636a59c268a1ed9dd74e2443ca1e829e0e2.png)

In the consumer service,

If I remove `WithProcessSpan` and create a normal span with `otel.Tracer.Start` then my distributed tracing stops working i.e., traces from service-B doesn't show up anymore in the traces from service-A. So, naturally Service-A -\> Service-B direct connection disappears. The link between topic and consuming service stays because of the kafka consumer is auto instrumented. But the record headers aren't propagated to rest of the processes even if I use the same context.

And if I don't use `kgo.WithHooks(kotelService.Hooks()...)` as kgo options during kgo client creation, the link between the topic and the consuming service vanishes. And the receive span (i.e., the span that shows the receive process) doesn't show up on tracing.
