Commit 170c1f3
committed
fix: prevent IEEE 754 precision loss in OTLP nanosecond timestamps
Multiplying epoch milliseconds by 1,000,000 before BigInt conversion
produces values exceeding Number.MAX_SAFE_INTEGER (~9e15), causing
~256ns precision errors in ~0.2% of timestamps.
Convert to BigInt first, then multiply:
- getNowInNanoseconds(): BigInt(ms) * BigInt(1_000_000)
- calculateDurationFromStart(): same pattern
- calculateDurationFromStartJsDate(): same pattern
- recordRunDebugLog(): same pattern
The correct pattern already existed in convertDateToNanoseconds() in
the same file.
Fixes #3292
Made-with: Cursor1 parent 73ea586 commit 170c1f3
File tree
2 files changed
+4
-4
lines changed- apps/webapp/app/v3/eventRepository
2 files changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | | - | |
| 218 | + | |
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| |||
0 commit comments