# Kibana: Service map not display connections

**URL:** <https://discuss.elastic.co/t/kibana-service-map-not-display-connections/268161>\
**Category:** Elastic Observability\
**Created:** [March 24, 2021, 3:59am UTC](https://discuss.elastic.co/t/kibana-service-map-not-display-connections/268161 "2021-03-24T03:59:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jialipassion](https://avatars.discourse-cdn.com/v4/letter/j/7ab992/32.png) [@jialipassion](https://discuss.elastic.co/u/jialipassion)\
**Post date:** [March 24, 2021, 3:59am UTC](https://discuss.elastic.co/t/kibana-service-map-not-display-connections/268161/1 "2021-03-24T03:59:09Z")

</div>

I am using Kibana/ElasticSearch/APM 7.11.1.  
And I am not working on http server, so I am using nodejs agent to create the custom `transactions`. I have two services, `producer` and `consumer`.  
The trace sequence is:

1. producer startTransaction `trace006`.
2. producer startSpan `request222`.
3. producer send traceparent to consumder
4. consumer startTransaction `request224` with `childOf` traceparent from producer.
5. consumer startTransaction `request334` with `childOf` traceparent from producer.

And the timeline displayed correctly,

 ![Screen Shot 2021-03-24 at 11.52.52](https://us1.discourse-cdn.com/elastic/original/3X/f/7/f7569eb55cd95ce81f04668d119db2d671332f34.png) , the relationship of `producer` and `consumer` can be displayed in the timeline graph.

But the service map didn't show the connections between the `producer` and the `consumer` services. Only two standalone service nodes.

 ![Screen Shot 2021-03-24 at 11.58.15](https://us1.discourse-cdn.com/elastic/original/3X/2/b/2b3c5714d98b55aa8a02771be52fe8255010eba5.png)

Is there any other settings or special code I need to do?

I found another issue here [Service Map not linking services - #4 by GregKalapos](https://discuss.elastic.co/t/service-map-not-linking-services/262096/4),  
and I think the problem is the same.  
I am writing some simulation nodejs app to generate transaction/span data. So is there any doc or code sample to set `span.destination` correctly?

Here is my code:

1. NodeJS app1 acts as `producer` service.

```auto
const agent =
       require('elastic-apm-node').start({'producer', serverUrl: 'http://localhost:8200'});
const startTime = Date.now();
const tran = createTransaction(producer, 'trace006', startTime);

const traceparent = producer.currentTraceparent;
const req1 =
    tran.startSpan('request222', 'custom', {startTime: startTime + 10});
req1.setDestinationContext(
    {service: {name: 'consumer', resource: 'db', type: req1.type}});
// use ipc communication channel to send the traceparent to another nodejs process.
sendTraceParentWithIPCToConsumer();
req1.end();
tran.end();

```

1. NodeJS app2 acts as `consumer` service.

```auto
const agent =
       require('elastic-apm-node').start({'consumer', serverUrl: 'http://localhost:8200'});
ipc.on('message', traceparent => {
  const startTime = Date.now();
  const req2 =
      agent.startTransaction('request224', {startTime, childOf: traceParent});
   req2.end(startTime + 100);
  const req3 =
      agent.startTransaction('request334', {startTime, childOf: traceParent});
  req3.end(startTime + 200);
});

```

So I am trying to use `req1.setDestinationContext( {service: {name: 'consumer', resource: 'db', type: req1.type}});` to set destionation, but not working...

I tried to set the `span.type` to `external`, now the link is displayed, but not `producer -> consumer`, it is `producer -> db`, where the `db` is the `resource` of the destination context.

Thank you.

---

<div class="post-metadata">

**Author:** ![jialipassion](https://avatars.discourse-cdn.com/v4/letter/j/7ab992/32.png) [@jialipassion](https://discuss.elastic.co/u/jialipassion)\
**Post date:** [March 25, 2021, 2:36am UTC](https://discuss.elastic.co/t/kibana-service-map-not-display-connections/268161/2 "2021-03-25T02:36:53Z")

</div>

Finally I copied the code and data from `http-shared` code of `nodejs-agent` to simulate the data and behavior, now the link is working.

---

<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:** [November 4, 2022, 8:27am UTC](https://discuss.elastic.co/t/kibana-service-map-not-display-connections/268161/3 "2022-11-04T08:27:13Z")

</div>


