diff --git a/x-pack/plugins/apm/server/lib/service_map/dedupe_connections/index.test.ts b/x-pack/plugins/apm/server/lib/service_map/dedupe_connections/index.test.ts index 01d6a2e2e81bc..572d73e368c7a 100644 --- a/x-pack/plugins/apm/server/lib/service_map/dedupe_connections/index.test.ts +++ b/x-pack/plugins/apm/server/lib/service_map/dedupe_connections/index.test.ts @@ -140,4 +140,21 @@ describe('dedupeConnections', () => { // @ts-ignore expect(nodejsNode?.data[SPAN_SUBTYPE]).toBe('aa'); }); + + it('processes connections without a matching "service" aggregation', () => { + const response: ServiceMapResponse = { + services: [javaService], + discoveredServices: [], + connections: [ + { + source: javaService, + destination: nodejsService + } + ] + }; + + const { elements } = dedupeConnections(response); + + expect(elements.length).toBe(3); + }); }); diff --git a/x-pack/plugins/apm/server/lib/service_map/dedupe_connections/index.ts b/x-pack/plugins/apm/server/lib/service_map/dedupe_connections/index.ts index 6a433367d8217..e5d7c0b2de10c 100644 --- a/x-pack/plugins/apm/server/lib/service_map/dedupe_connections/index.ts +++ b/x-pack/plugins/apm/server/lib/service_map/dedupe_connections/index.ts @@ -88,7 +88,7 @@ export function dedupeConnections(response: ServiceMapResponse) { serviceName = node[SERVICE_NAME]; } - const matchedServiceNodes = services.filter( + const matchedServiceNodes = serviceNodes.filter( serviceNode => serviceNode[SERVICE_NAME] === serviceName );