Skip to content

Commit df17e8d

Browse files
authored
Identify uninstrumented services (#659)
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
1 parent b07aab8 commit df17e8d

File tree

4 files changed

+51
-0
lines changed

4 files changed

+51
-0
lines changed

packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanBarRow.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ type SpanBarRowProps = {
4848
serviceName: string;
4949
}
5050
| TNil;
51+
noInstrumentedServer?:
52+
| {
53+
color: string;
54+
serviceName: string;
55+
}
56+
| TNil;
5157
showErrorIcon: boolean;
5258
getViewedBounds: ViewedBoundsFunctionType;
5359
traceStartTime: number;
@@ -87,6 +93,7 @@ export default class SpanBarRow extends React.PureComponent<SpanBarRowProps> {
8793
isMatchingFilter,
8894
numTicks,
8995
rpc,
96+
noInstrumentedServer,
9097
showErrorIcon,
9198
getViewedBounds,
9299
traceStartTime,
@@ -151,6 +158,16 @@ export default class SpanBarRow extends React.PureComponent<SpanBarRowProps> {
151158
{rpc.serviceName}
152159
</span>
153160
)}
161+
{noInstrumentedServer && (
162+
<span>
163+
<IoArrowRightA />{' '}
164+
<i
165+
className="SpanBarRow--rpcColorMarker"
166+
style={{ background: noInstrumentedServer.color }}
167+
/>
168+
{noInstrumentedServer.serviceName}
169+
</span>
170+
)}
154171
</span>
155172
<small className="endpoint-name">{rpc ? rpc.operationName : operationName}</small>
156173
</a>

packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/VirtualizedTraceView.test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,23 @@ describe('<VirtualizedTraceViewImpl>', () => {
355355
)
356356
).toBe(true);
357357
});
358+
359+
it('renders a SpanBarRow with a client span and no instrumented server span', () => {
360+
const externServiceName = 'externalServiceTest';
361+
const leafSpan = trace.spans.find(span => !span.hasChildren);
362+
const leafSpanIndex = trace.spans.indexOf(leafSpan);
363+
const clientTags = [
364+
{ key: 'span.kind', value: 'client' },
365+
{ key: 'peer.service', value: externServiceName },
366+
...leafSpan.tags,
367+
];
368+
const altTrace = updateSpan(trace, leafSpanIndex, { tags: clientTags });
369+
wrapper.setProps({ trace: altTrace });
370+
const rowWrapper = mount(instance.renderRow('some-key', {}, leafSpanIndex, {}));
371+
const spanBarRow = rowWrapper.find(SpanBarRow);
372+
expect(spanBarRow.length).toBe(1);
373+
expect(spanBarRow.prop('noInstrumentedServer')).not.toBeNull();
374+
});
358375
});
359376

360377
describe('shouldScrollToFirstUiFindMatch', () => {

packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/VirtualizedTraceView.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
createViewedBoundsFunc,
3232
findServerChildSpan,
3333
isErrorSpan,
34+
isKindClient,
3435
spanContainsErredSpan,
3536
ViewedBoundsFunctionType,
3637
} from './utils';
@@ -44,6 +45,7 @@ import TTraceTimeline from '../../../types/TTraceTimeline';
4445

4546
import './VirtualizedTraceView.css';
4647
import updateUiFind from '../../../utils/update-ui-find';
48+
import { PEER_SERVICE } from '../../../constants/tag-keys';
4749

4850
type RowState = {
4951
isDetail: boolean;
@@ -360,6 +362,17 @@ export class VirtualizedTraceViewImpl extends React.Component<VirtualizedTraceVi
360362
};
361363
}
362364
}
365+
const peerServiceKV = span.tags.find(kv => kv.key === PEER_SERVICE);
366+
// Leaf, kind == client and has peer.service tag, is likely a client span that does a request
367+
// to an uninstrumented/external service
368+
let noInstrumentedServer = null;
369+
if (!span.hasChildren && peerServiceKV && isKindClient(span)) {
370+
noInstrumentedServer = {
371+
serviceName: peerServiceKV.value,
372+
color: colorGenerator.getColorByKey(peerServiceKV.value),
373+
};
374+
}
375+
363376
return (
364377
<div className="VirtualizedTraceView--row" key={key} style={style} {...attrs}>
365378
<SpanBarRow
@@ -373,6 +386,7 @@ export class VirtualizedTraceViewImpl extends React.Component<VirtualizedTraceVi
373386
onDetailToggled={detailToggle}
374387
onChildrenToggled={childrenToggle}
375388
rpc={rpc}
389+
noInstrumentedServer={noInstrumentedServer}
376390
showErrorIcon={showErrorIcon}
377391
getViewedBounds={this.getViewedBounds()}
378392
traceStartTime={trace.startTime}

packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/utils.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,7 @@ export function findServerChildSpan(spans: Span[]) {
117117
return null;
118118
}
119119

120+
export const isKindClient = (span: Span): Boolean =>
121+
span.tags.some(({ key, value }) => key === 'span.kind' && value === 'client');
122+
120123
export { formatDuration } from '../../../utils/date';

0 commit comments

Comments
 (0)