Skip to content

Commit f6beb42

Browse files
committed
.
1 parent aad1cb6 commit f6beb42

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

packages/core/src/utils/should-ignore-span.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ export function shouldIgnoreSpan(
2828
continue;
2929
}
3030

31-
if (!pattern.name && !pattern.op && !pattern.attributes) {
31+
const hasAttributes = !!pattern.attributes && Object.keys(pattern.attributes).length > 0;
32+
if (!pattern.name && !pattern.op && !hasAttributes) {
3233
continue;
3334
}
3435

packages/core/test/lib/utils/should-ignore-span.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ describe('shouldIgnoreSpan', () => {
134134
expect(shouldIgnoreSpan(span, [{ attributes: { 'missing.key': 'x' } }])).toBe(false);
135135
});
136136

137+
it('does not match a filter with an empty attributes object', () => {
138+
const span = { description: 'foo', op: 'bar', attributes: { x: 1 } };
139+
expect(shouldIgnoreSpan(span, [{ attributes: {} }])).toBe(false);
140+
});
141+
137142
it('requires every attribute entry to match', () => {
138143
const span = { description: 'span', op: 'op', attributes: { a: 1, b: 2 } };
139144
expect(shouldIgnoreSpan(span, [{ attributes: { a: 1, b: 2 } }])).toBe(true);

0 commit comments

Comments
 (0)