Skip to content

Commit 8ae755c

Browse files
committed
Add origin to start time to stop flaking long tasks from appearing at index 0 in the list
1 parent be21d5d commit 8ae755c

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

packages/nextjs/test/integration/test/client/tracingFetch.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
const { expectRequestCount, isTransactionRequest, expectTransaction } = require('../utils/client');
1+
const {
2+
expectRequestCount,
3+
isTransactionRequest,
4+
expectTransaction,
5+
extractEnvelopeFromRequest,
6+
} = require('../utils/client');
27

38
module.exports = async ({ page, url, requests }) => {
49
await page.goto(`${url}/fetch`);
510
await page.click('button');
611
await page.waitForRequest(isTransactionRequest);
712

8-
await expectRequestCount(requests, { transactions: 1 });
913
expectTransaction(requests.transactions[0], {
1014
transaction: '/fetch',
1115
type: 'transaction',
@@ -22,4 +26,5 @@ module.exports = async ({ page, url, requests }) => {
2226
},
2327
],
2428
});
29+
await expectRequestCount(requests, { transactions: 1 });
2530
};

packages/tracing/src/browser/metrics/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function startTrackingLongTasks(): void {
4949
if (!transaction) {
5050
return;
5151
}
52-
const startTime = msToSec(entry.startTime);
52+
const startTime = msToSec((browserPerformanceTimeOrigin as number) + entry.startTime);
5353
const duration = msToSec(entry.duration);
5454
transaction.startChild({
5555
description: 'Long Task',

0 commit comments

Comments
 (0)