Skip to content

Commit

Permalink
🔊[RUMF-257] report abnormal performance.now() (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcaudan authored Feb 7, 2020
1 parent 3391513 commit 08bdb24
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/rum/src/rum.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
addMonitoringMessage,
Batch,
Configuration,
Context,
Expand Down Expand Up @@ -144,6 +145,8 @@ export function startRum(
)
)

reportAbnormalPerformanceNow()

const batch = startRumBatch(
configuration,
session,
Expand Down Expand Up @@ -343,3 +346,13 @@ export function handleLongTaskEntry(entry: PerformanceLongTaskTiming, addRumEven
},
})
}

function reportAbnormalPerformanceNow() {
if (performance.now() > 300e3 /* 5 min in ms*/) {
addMonitoringMessage(`Abnormal performance.now()
performance.now(): ${performance.now()}
Date.now(): ${Date.now()}
Navigation entries: ${JSON.stringify(performance.getEntriesByType('navigation'), undefined, 2)}
`)
}
}

0 comments on commit 08bdb24

Please sign in to comment.