Skip to content

Commit 595f2d3

Browse files
committed
switch to empty string as default value
1 parent d8feca0 commit 595f2d3

File tree

2 files changed

+2
-26
lines changed

2 files changed

+2
-26
lines changed

packages/browser-utils/src/metrics/browserMetrics.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,10 +541,7 @@ export function _addResourceSpans(
541541
setResourceEntrySizeData(attributes, entry, 'decodedBodySize', 'http.decoded_response_content_length');
542542

543543
if (entry.deliveryType != null) {
544-
// Falling back to 'default' as attributes with empty string are dropped by our backend.
545-
// The empty string is the default value for the deliveryType attribute, indicating that
546-
// the browser actually sent a request (as opposed to retrieved the response from its cache).
547-
attributes['http.response_delivery_type'] = entry.deliveryType || 'default';
544+
attributes['http.response_delivery_type'] = entry.deliveryType;
548545
}
549546

550547
if ('renderBlockingStatus' in entry) {

packages/browser-utils/test/browser/browserMetrics.test.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ describe('_addResourceSpans', () => {
341341

342342
// resource delivery types: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/deliveryType
343343
// i.e. better but not yet widely supported way to check for browser cache hit
344-
it.each(['cache', 'navigational-prefetch'])(
344+
it.each(['cache', 'navigational-prefetch', ''])(
345345
'attaches delivery type ("%s") to resource spans if available',
346346
deliveryType => {
347347
const spans: Span[] = [];
@@ -364,27 +364,6 @@ describe('_addResourceSpans', () => {
364364
expect(spanToJSON(spans[0]!).data).toMatchObject({ 'http.response_delivery_type': deliveryType });
365365
},
366366
);
367-
368-
it('attaches "default" as delivery if the empty string ("") default value is set', () => {
369-
const spans: Span[] = [];
370-
371-
getClient()?.on('spanEnd', span => {
372-
spans.push(span);
373-
});
374-
375-
const entry: ResourceEntry = {
376-
initiatorType: 'css',
377-
transferSize: 0,
378-
encodedBodySize: 0,
379-
decodedBodySize: 0,
380-
deliveryType: '',
381-
};
382-
383-
_addResourceSpans(span, entry, resourceEntryName, 100, 23, 345);
384-
385-
expect(spans).toHaveLength(1);
386-
expect(spanToJSON(spans[0]!).data).toMatchObject({ 'http.response_delivery_type': 'default' });
387-
});
388367
});
389368

390369
const setGlobalLocation = (location: Location) => {

0 commit comments

Comments
 (0)