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

Recognize uninstrumented services via both producer and client span kinds #1681

Merged
merged 2 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -357,21 +357,33 @@ describe('<VirtualizedTraceViewImpl>', () => {
).toBe(true);
});

it('renders a SpanBarRow with a client span and no instrumented server span', () => {
it('renders a SpanBarRow with a client or producer span and no instrumented server span', () => {
const externServiceName = 'externalServiceTest';
const leafSpan = trace.spans.find(span => !span.hasChildren);
const leafSpanIndex = trace.spans.indexOf(leafSpan);
const clientTags = [
{ key: 'span.kind', value: 'client' },
{ key: 'peer.service', value: externServiceName },
...leafSpan.tags,
const tags = [
[
// client span
{ key: 'span.kind', value: 'client' },
{ key: 'peer.service', value: externServiceName },
...leafSpan.tags,
],
[
// producer span
{ key: 'span.kind', value: 'producer' },
{ key: 'peer.service', value: externServiceName },
...leafSpan.tags,
],
];
const altTrace = updateSpan(trace, leafSpanIndex, { tags: clientTags });
wrapper.setProps({ trace: altTrace });
const rowWrapper = mount(instance.renderRow('some-key', {}, leafSpanIndex, {}));
const spanBarRow = rowWrapper.find(SpanBarRow);
expect(spanBarRow.length).toBe(1);
expect(spanBarRow.prop('noInstrumentedServer')).not.toBeNull();

tags.forEach(tag => {
const altTrace = updateSpan(trace, leafSpanIndex, { tags: tag });
wrapper.setProps({ trace: altTrace });
const rowWrapper = mount(instance.renderRow('some-key', {}, leafSpanIndex, {}));
const spanBarRow = rowWrapper.find(SpanBarRow);
expect(spanBarRow.length).toBe(1);
expect(spanBarRow.prop('noInstrumentedServer')).not.toBeNull();
});
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
findServerChildSpan,
isErrorSpan,
isKindClient,
isKindProducer,
spanContainsErredSpan,
ViewedBoundsFunctionType,
} from './utils';
Expand Down Expand Up @@ -369,7 +370,7 @@ export class VirtualizedTraceViewImpl extends React.Component<VirtualizedTraceVi
// 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)) {
if (!span.hasChildren && peerServiceKV && (isKindClient(span) || isKindProducer(span))) {
noInstrumentedServer = {
serviceName: peerServiceKV.value,
color: colorGenerator.getColorByKey(peerServiceKV.value),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,7 @@ export function findServerChildSpan(spans: Span[]) {
export const isKindClient = (span: Span): Boolean =>
span.tags.some(({ key, value }) => key === 'span.kind' && value === 'client');

export const isKindProducer = (span: Span): Boolean =>
span.tags.some(({ key, value }) => key === 'span.kind' && value === 'producer');

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