Skip to content

Commit

Permalink
null check for span.logs
Browse files Browse the repository at this point in the history
Signed-off-by: Amanda Chesin <Amanda.Chesin1@aexp.com>
  • Loading branch information
achesin committed Apr 13, 2021
1 parent 7931bf7 commit 63c5d65
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/jaeger-ui/src/utils/filter-spans.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ describe('filterSpans', () => {
expect(filterSpans('processTagKey2', spans)).toEqual(new Set([spanID2]));
});

it('should return no spans when logs is null', () => {
const nullSpan = { ...span0, logs: null };
expect(filterSpans('logFieldKey1', [nullSpan])).toEqual(new Set([]));
});

it("should return spans whose process.processTags' kv.value match a filter", () => {
expect(filterSpans('processTagValue1', spans)).toEqual(new Set([spanID0, spanID2]));
expect(filterSpans('processTagValue0', spans)).toEqual(new Set([spanID0]));
Expand Down
2 changes: 1 addition & 1 deletion packages/jaeger-ui/src/utils/filter-spans.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default function filterSpans(textFilter: string, spans: Span[] | TNil) {
isTextInFilters(includeFilters, span.operationName) ||
isTextInFilters(includeFilters, span.process.serviceName) ||
isTextInKeyValues(span.tags) ||
span.logs.some(log => isTextInKeyValues(log.fields)) ||
(span.logs !== null && span.logs.some(log => isTextInKeyValues(log.fields))) ||
isTextInKeyValues(span.process.tags) ||
includeFilters.some(filter => filter.replace(/^0*/, '') === span.spanID.replace(/^0*/, ''));

Expand Down

0 comments on commit 63c5d65

Please sign in to comment.