Skip to content
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
2 changes: 1 addition & 1 deletion packages/tracing-internal/src/browser/metrics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ function setResourceEntrySizeData(
dataKey: 'http.response_transfer_size' | 'http.response_content_length' | 'http.decoded_response_content_length',
): void {
const entryVal = entry[key];
if (entryVal !== undefined && entryVal < MAX_INT_AS_BYTES) {
if (entryVal != null && entryVal < MAX_INT_AS_BYTES) {
data[dataKey] = entryVal;
}
}
22 changes: 22 additions & 0 deletions packages/tracing-internal/test/browser/metrics/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,26 @@ describe('_addResourceSpans', () => {
}),
);
});

// resource sizes can be set as null on some browsers
// https://github.com/getsentry/sentry/pull/60601
it('does not attach null resource sizes', () => {
const entry = {
initiatorType: 'css',
transferSize: null,
encodedBodySize: null,
decodedBodySize: null,
} as unknown as ResourceEntry;

_addResourceSpans(transaction, entry, '/assets/to/css', 100, 23, 345);

// eslint-disable-next-line @typescript-eslint/unbound-method
expect(transaction.startChild).toHaveBeenCalledTimes(1);
// eslint-disable-next-line @typescript-eslint/unbound-method
expect(transaction.startChild).toHaveBeenLastCalledWith(
expect.objectContaining({
data: {},
}),
);
});
});