From 53ab0bc23bbf59c44254c6cbd59746d830779f78 Mon Sep 17 00:00:00 2001 From: Ruben Vargas Date: Sat, 4 Apr 2020 09:34:19 -0600 Subject: [PATCH] DDG: Remove kind.server filter and handle service calling itself --- .../src/model/ddg/transformTracesToPaths.tsx | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/jaeger-ui/src/model/ddg/transformTracesToPaths.tsx b/packages/jaeger-ui/src/model/ddg/transformTracesToPaths.tsx index 76e7b10c59..4cf1297dbf 100644 --- a/packages/jaeger-ui/src/model/ddg/transformTracesToPaths.tsx +++ b/packages/jaeger-ui/src/model/ddg/transformTracesToPaths.tsx @@ -36,20 +36,24 @@ function transformTracesToPaths( return !span.hasChildren; }) .forEach(leaf => { - const spans = spanAncestorIds(leaf).map(id => { + const spans = spanAncestorIds(leaf).reduce((acumulator: Span[], id: string): Span[] => { const span = spanMap.get(id); if (!span) throw new Error(`Ancestor spanID ${id} not found in trace ${traceID}`); - return span; - }); + if (acumulator.length > 0) { + const headSpan = acumulator[acumulator.length - 1]; + if (headSpan.processID === span.processID) { + return acumulator; + } + } + acumulator.push(span); + return acumulator; + }, []); spans.reverse(); spans.push(leaf); - - const path: TDdgPayloadEntry[] = spans - .filter(span => span.tags.find(({ key, value }) => key === 'span.kind' && value === 'server')) - .map(({ processID, operationName: operation }) => ({ - service: data.processes[processID].serviceName, - operation, - })); + const path: TDdgPayloadEntry[] = spans.map(({ processID, operationName: operation }) => ({ + service: data.processes[processID].serviceName, + operation, + })); if ( path.some(