Skip to content

Commit

Permalink
Identify uninstrumented services
Browse files Browse the repository at this point in the history
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
  • Loading branch information
rubenvp8510 committed Nov 11, 2020
1 parent b07aab8 commit ab0fa50
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ type SpanBarRowProps = {
serviceName: string;
}
| TNil;
noInstrumentedServer?:
| {
color: string;
serviceName: string;
}
| TNil;
showErrorIcon: boolean;
getViewedBounds: ViewedBoundsFunctionType;
traceStartTime: number;
Expand Down Expand Up @@ -87,6 +93,7 @@ export default class SpanBarRow extends React.PureComponent<SpanBarRowProps> {
isMatchingFilter,
numTicks,
rpc,
noInstrumentedServer,
showErrorIcon,
getViewedBounds,
traceStartTime,
Expand Down Expand Up @@ -151,6 +158,16 @@ export default class SpanBarRow extends React.PureComponent<SpanBarRowProps> {
{rpc.serviceName}
</span>
)}
{noInstrumentedServer && (
<span>
<IoArrowRightA />{' '}
<i
className="SpanBarRow--rpcColorMarker"
style={{ background: noInstrumentedServer.color }}
/>
{noInstrumentedServer.serviceName}
</span>
)}
</span>
<small className="endpoint-name">{rpc ? rpc.operationName : operationName}</small>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
createViewedBoundsFunc,
findServerChildSpan,
isErrorSpan,
isKindClient,
spanContainsErredSpan,
ViewedBoundsFunctionType,
} from './utils';
Expand All @@ -44,6 +45,7 @@ import TTraceTimeline from '../../../types/TTraceTimeline';

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

type RowState = {
isDetail: boolean;
Expand Down Expand Up @@ -360,6 +362,17 @@ export class VirtualizedTraceViewImpl extends React.Component<VirtualizedTraceVi
};
}
}
const peerServiceKV = span.tags.find(kv => kv.key === PEER_SERVICE);
// Leaf, kind == client and has peer.service tag, is likely a client span that does a request
// to an uninstrumented/external service
let noInstrumentedServer = null;
if (!span.hasChildren && peerServiceKV && isKindClient(span)) {
noInstrumentedServer = {
serviceName: peerServiceKV.value,
color: colorGenerator.getColorByKey(peerServiceKV.value),
};
}

return (
<div className="VirtualizedTraceView--row" key={key} style={style} {...attrs}>
<SpanBarRow
Expand All @@ -373,6 +386,7 @@ export class VirtualizedTraceViewImpl extends React.Component<VirtualizedTraceVi
onDetailToggled={detailToggle}
onChildrenToggled={childrenToggle}
rpc={rpc}
noInstrumentedServer={noInstrumentedServer}
showErrorIcon={showErrorIcon}
getViewedBounds={this.getViewedBounds()}
traceStartTime={trace.startTime}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,7 @@ export function findServerChildSpan(spans: Span[]) {
return null;
}

export const isKindClient = (span: Span) =>
span.tags.find(({ key, value }) => key === 'span.kind' && value === 'client');

export { formatDuration } from '../../../utils/date';

0 comments on commit ab0fa50

Please sign in to comment.