Skip to content

Commit

Permalink
🔇[RUMF-257] remove logging (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcaudan authored Feb 12, 2020
1 parent 33178dc commit 479b558
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 43 deletions.
13 changes: 0 additions & 13 deletions packages/rum/src/rum.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
addMonitoringMessage,
Batch,
Configuration,
Context,
Expand Down Expand Up @@ -145,8 +144,6 @@ export function startRum(
)
)

reportAbnormalPerformanceNow()

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

function reportAbnormalPerformanceNow() {
if (performance.now() > 300e3 /* 5 min in ms*/) {
addMonitoringMessage(`[RUMF-257] Abnormal performance.now()
performance.now(): ${performance.now() / 6e4}s
Date.now(): ${new Date().toISOString()}
Navigation entries: ${JSON.stringify(performance.getEntriesByType('navigation'), undefined, 2)}
`)
}
}
33 changes: 3 additions & 30 deletions packages/rum/src/viewTracker.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { addMonitoringMessage, generateUUID, monitor, msToNs, throttle } from '@datadog/browser-core'
import { generateUUID, monitor, msToNs, throttle } from '@datadog/browser-core'

import { LifeCycle, LifeCycleEventType } from './lifeCycle'
import { PerformancePaintTiming, RumEvent, RumEventCategory } from './rum'
Expand All @@ -25,8 +25,6 @@ interface ViewContext {
export let viewContext: ViewContext

const THROTTLE_VIEW_UPDATE_PERIOD = 3000
const pageOrigin = Date.now()
let pageLoad = 0
let startTimestamp: number
let startOrigin: number
let documentVersion: number
Expand All @@ -45,15 +43,9 @@ export function trackView(

newView(location, session, upsertRumEvent)
trackHistory(location, session, upsertRumEvent)
trackMeasures(lifeCycle, scheduleViewUpdate, session)
trackMeasures(lifeCycle, scheduleViewUpdate)
trackRenewSession(location, lifeCycle, session, upsertRumEvent)

window.addEventListener('load', trackLoad)
function trackLoad() {
pageLoad = performance.now()
window.removeEventListener('load', trackLoad)
}

beforeFlushOnUnload(() => updateView(upsertRumEvent))
}

Expand Down Expand Up @@ -126,29 +118,10 @@ function areDifferentViews(previous: Location, current: Location) {
return previous.pathname !== current.pathname
}

function reportAbnormalLoadEvent(navigationEntry: PerformanceNavigationTiming, session: RumSession) {
if (navigationEntry.loadEventEnd > 36e5 /* one hour in ms */) {
addMonitoringMessage(
`[RUMF-257] abnormal load event
isTracked: ${session.isTracked()}
Session Id: ${session.getId()}
View Id: ${viewContext.id}
Load event (entry): ${navigationEntry.loadEventEnd / 6e4}min
Load event (listener): ${pageLoad / 6e4}min
Page duration (Date.now()): ${(Date.now() - pageOrigin) / 6e4}min
Page duration (perf.now()): ${performance.now() / 6e4}min
Entry: ${JSON.stringify(navigationEntry)}
Previous navigation entries: ${JSON.stringify(performance.getEntriesByType('navigation'))}
Perf timing: ${JSON.stringify(performance.timing)}`
)
}
}

function trackMeasures(lifeCycle: LifeCycle, scheduleViewUpdate: () => void, session: RumSession) {
function trackMeasures(lifeCycle: LifeCycle, scheduleViewUpdate: () => void) {
lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, (entry) => {
if (entry.entryType === 'navigation') {
const navigationEntry = entry as PerformanceNavigationTiming
reportAbnormalLoadEvent(navigationEntry, session)
viewMeasures = {
...viewMeasures,
domComplete: msToNs(navigationEntry.domComplete),
Expand Down

0 comments on commit 479b558

Please sign in to comment.