Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of a helper for trace name when preparing trace data #544

Merged
merged 3 commits into from
Apr 8, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions packages/jaeger-ui/src/model/transform-trace-data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import _isEqual from 'lodash/isEqual';

import { getTraceSpanIdsAsTree } from '../selectors/trace';
import { getConfigValue } from '../utils/config/get-config';
import { getTraceName } from './trace-viewer';
import { KeyValuePair, Span, SpanData, Trace, TraceData } from '../types/trace';
import TreeNode from '../utils/TreeNode';

Expand Down Expand Up @@ -120,7 +121,6 @@ export default function transformTraceData(data: TraceData & { spans: SpanData[]
const tree = getTraceSpanIdsAsTree(data);
const spans: Span[] = [];
const svcCounts: Record<string, number> = {};
let traceName = '';

tree.walk((spanID: string, node: TreeNode, depth: number = 0) => {
if (spanID === '__root__') {
Expand All @@ -132,9 +132,6 @@ export default function transformTraceData(data: TraceData & { spans: SpanData[]
}
const { serviceName } = span.process;
svcCounts[serviceName] = (svcCounts[serviceName] || 0) + 1;
if (!span.references || !span.references.length) {
traceName = `${serviceName}: ${span.operationName}`;
}
span.relativeStartTime = span.startTime - traceStartTime;
span.depth = depth - 1;
span.hasChildren = node.children.length > 0;
Expand Down Expand Up @@ -163,6 +160,7 @@ export default function transformTraceData(data: TraceData & { spans: SpanData[]
});
spans.push(span);
});
const traceName = getTraceName(spans);
const services = Object.keys(svcCounts).map(name => ({ name, numberOfSpans: svcCounts[name] }));
return {
services,
Expand Down