Skip to content

Commit 83421d9

Browse files
authored
fix(profiling): Round continuous profile timestamps appropriately (#104541)
When converting the reference epoch timestamp to iso strings, make sure we round the timestamps appropriately. Start timestamps should be rounded down and end timestamps should be rounded up so that we don't miss any samples due to bad rounding. One example of this is if we have 2 samples in a chunk, and the end timestamp is rounded down, the 2nd sample is then lost.
1 parent abf2622 commit 83421d9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

static/app/utils/profiling/routes.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,10 @@ export function generateProfileRouteFromProfileReference({
214214
profilerId: reference.profiler_id,
215215
frameName,
216216
framePackage,
217-
start: new Date(reference.start * 1e3).toISOString(),
218-
end: new Date(reference.end * 1e3).toISOString(),
217+
// when converting to a timestamp, we round the start timestamp down and round
218+
// the end timestamp up to the millisecond to ensure we capture the full profile
219+
start: new Date(Math.floor(reference.start * 1e3)).toISOString(),
220+
end: new Date(Math.ceil(reference.end * 1e3)).toISOString(),
219221
query: dropUndefinedKeys({
220222
...query,
221223
frameName,

0 commit comments

Comments
 (0)