Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔇[RUMF-257] remove logging #265

Merged
merged 1 commit into from
Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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