MM-58281 Change performance timestamps to be floats (#27046)

* MM-58281 Change performance timestamps to be floats

* Commit missed line
Этот коммит содержится в:
Harrison Healey
2024-05-17 13:52:03 -04:00
коммит произвёл GitHub
родитель 3e734ee949
Коммит b9f7d38cb1
5 изменённых файлов: 27 добавлений и 27 удалений

Просмотреть файл

@@ -52,23 +52,23 @@ describe('PerformanceReporter', () => {
expect(sendBeacon.mock.calls[0][0]).toEqual(siteUrl + '/api/v4/client_perf');
const report = JSON.parse(sendBeacon.mock.calls[0][1]);
expect(report).toMatchObject({
start: Math.round(performance.timeOrigin + testMarkA.startTime),
end: Math.round(performance.timeOrigin + testMarkB.startTime),
start: performance.timeOrigin + testMarkA.startTime,
end: performance.timeOrigin + testMarkB.startTime,
histograms: [
{
metric: 'testMeasureA',
value: testMarkB.startTime - testMarkA.startTime,
timestamp: Math.round(performance.timeOrigin + testMarkA.startTime),
timestamp: performance.timeOrigin + testMarkA.startTime,
},
{
metric: 'testMeasureB',
value: testMarkC.startTime - testMarkA.startTime,
timestamp: Math.round(performance.timeOrigin + testMarkA.startTime),
timestamp: performance.timeOrigin + testMarkA.startTime,
},
{
metric: 'testMeasureC',
value: testMarkC.startTime - testMarkB.startTime,
timestamp: Math.round(performance.timeOrigin + testMarkB.startTime),
timestamp: performance.timeOrigin + testMarkB.startTime,
},
],
});
@@ -94,7 +94,7 @@ describe('PerformanceReporter', () => {
expect(reporter.handleObservations).toHaveBeenCalled();
const timestamp = Math.round(performance.timeOrigin + performance.now());
const timestamp = performance.timeOrigin + performance.now();
await waitForReport();

Просмотреть файл

@@ -141,7 +141,7 @@ export default class PerformanceReporter {
this.histogramMeasures.push({
metric: entry.name,
value: entry.duration,
timestamp: Math.round(performance.timeOrigin + entry.startTime),
timestamp: performance.timeOrigin + entry.startTime,
});
}
@@ -166,7 +166,7 @@ export default class PerformanceReporter {
this.histogramMeasures.push({
metric: metric.name,
value: metric.value,
timestamp: Math.round(performance.timeOrigin + performance.now()),
timestamp: performance.timeOrigin + performance.now(),
});
}
@@ -267,7 +267,7 @@ export default class PerformanceReporter {
counterMeasures.push({
metric: name,
value,
timestamp: Math.round(now),
timestamp: now,
});
}