Skip to content

feat(tracing): Track PerformanceResourceTiming.renderBlockingStatus #7127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 13, 2023
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
1 change: 1 addition & 0 deletions packages/replay/test/fixtures/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export function Transaction(obj?: Partial<Event>): any {
'Transfer Size': 1097,
'Encoded Body Size': 797,
'Decoded Body Size': 1885,
'resource.render_blocking_status': 'non-blocking',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more bikeshed convo :p

Right now the blocked_main_thread span data key is set in the mobile sdks, to get File I/O perf issues working.

Could we re-use that? I'm fine with not - this works with me as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear you want to re-use the same key? I don't know about that, I'd prefer more closely matching the vendor implementation we're scraping from otherwise there will be work in the product to constantly explain the differences, vs. letting these keys be self-evident

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup makes sense, let's keep this unique to browser!

},
description: '/favicon.ico',
op: 'resource.other',
Expand Down
4 changes: 4 additions & 0 deletions packages/tracing/src/browser/metrics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ export interface ResourceEntry extends Record<string, unknown> {
transferSize?: number;
encodedBodySize?: number;
decodedBodySize?: number;
renderBlockingStatus?: string;
}

/** Create resource-related spans */
Expand Down Expand Up @@ -361,6 +362,9 @@ export function _addResourceSpans(
if ('decodedBodySize' in entry) {
data['Decoded Body Size'] = entry.decodedBodySize;
}
if ('renderBlockingStatus' in entry) {
data['resource.render_blocking_status'] = entry.renderBlockingStatus;
}

const startTimestamp = timeOrigin + startTime;
const endTimestamp = startTimestamp + duration;
Expand Down
6 changes: 6 additions & 0 deletions packages/tracing/test/browser/metrics/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ describe('_addResourceSpans', () => {
transferSize: 256,
encodedBodySize: 256,
decodedBodySize: 256,
renderBlockingStatus: 'non-blocking',
};
_addResourceSpans(transaction, entry, '/assets/to/me', 123, 456, 100);

Expand All @@ -61,6 +62,7 @@ describe('_addResourceSpans', () => {
transferSize: 256,
encodedBodySize: 256,
decodedBodySize: 256,
renderBlockingStatus: 'non-blocking',
};
_addResourceSpans(transaction, entry, '/assets/to/me', 123, 456, 100);

Expand All @@ -74,6 +76,7 @@ describe('_addResourceSpans', () => {
transferSize: 256,
encodedBodySize: 456,
decodedBodySize: 593,
renderBlockingStatus: 'non-blocking',
};

const timeOrigin = 100;
Expand All @@ -90,6 +93,7 @@ describe('_addResourceSpans', () => {
['Decoded Body Size']: entry.decodedBodySize,
['Encoded Body Size']: entry.encodedBodySize,
['Transfer Size']: entry.transferSize,
['resource.render_blocking_status']: entry.renderBlockingStatus,
},
description: '/assets/to/css',
endTimestamp: timeOrigin + startTime + duration,
Expand Down Expand Up @@ -143,6 +147,7 @@ describe('_addResourceSpans', () => {
transferSize: 0,
encodedBodySize: 0,
decodedBodySize: 0,
renderBlockingStatus: 'non-blocking',
};

_addResourceSpans(transaction, entry, '/assets/to/css', 100, 23, 345);
Expand All @@ -156,6 +161,7 @@ describe('_addResourceSpans', () => {
['Decoded Body Size']: entry.decodedBodySize,
['Encoded Body Size']: entry.encodedBodySize,
['Transfer Size']: entry.transferSize,
['resource.render_blocking_status']: entry.renderBlockingStatus,
},
}),
);
Expand Down