Skip to content

Commit 192bb61

Browse files
committed
always count span drops
1 parent 0492cc0 commit 192bb61

2 files changed

Lines changed: 23 additions & 4 deletions

File tree

packages/core/src/utils/prepareEvent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export function prepareEvent(
112112
}
113113

114114
client.recordDroppedEvent(reason, getDataCategoryByType(event.type));
115-
if (reason === 'callback_error' && event.type === 'transaction') {
115+
if (event.type === 'transaction') {
116116
client.recordDroppedEvent(reason, 'span', 1 + (event.spans || []).length);
117117
}
118118
});

packages/core/test/lib/client.test.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,8 +2142,8 @@ describe('Client', () => {
21422142
expect(recordLostEventSpy).toHaveBeenCalledWith('event_processor', 'error');
21432143
});
21442144

2145-
test('event processor records dropped transaction events', () => {
2146-
expect.assertions(1);
2145+
test('event processor records dropped transaction events and spans', () => {
2146+
expect.assertions(3);
21472147

21482148
const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN });
21492149
const client = new TestClient(options);
@@ -2153,9 +2153,28 @@ describe('Client', () => {
21532153
const scope = new Scope();
21542154
scope.addEventProcessor(() => null);
21552155

2156-
client.captureEvent({ transaction: '/dogs/are/great', type: 'transaction' }, {}, scope);
2156+
client.captureEvent(
2157+
{
2158+
transaction: '/dogs/are/great',
2159+
type: 'transaction',
2160+
spans: [
2161+
{
2162+
description: 'fetch dogs',
2163+
data: {},
2164+
status: 'ok',
2165+
span_id: '9e15bf99fbe4bc80',
2166+
start_timestamp: 1591603196.637835,
2167+
trace_id: '86f39e84263a4de99c326acab3bfe3bd',
2168+
},
2169+
],
2170+
},
2171+
{},
2172+
scope,
2173+
);
21572174

2175+
expect(recordLostEventSpy).toHaveBeenCalledTimes(2);
21582176
expect(recordLostEventSpy).toHaveBeenCalledWith('event_processor', 'transaction');
2177+
expect(recordLostEventSpy).toHaveBeenCalledWith('event_processor', 'span', 2);
21592178
});
21602179

21612180
test('mutating transaction name with event processors sets transaction-name-change metadata', () => {

0 commit comments

Comments
 (0)