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-927] monitor timings with high values #884

Merged
merged 3 commits into from
Jun 7, 2021
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
1 change: 1 addition & 0 deletions packages/core/src/tools/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { monitor } from '../domain/internalMonitoring'
export const ONE_SECOND = 1000
export const ONE_MINUTE = 60 * ONE_SECOND
export const ONE_HOUR = 60 * ONE_MINUTE
export const ONE_DAY = 24 * ONE_HOUR
export const ONE_KILO_BYTE = 1024

export const enum DOM_EVENT {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import {
ResourceType,
ServerDuration,
toServerDuration,
ONE_DAY,
relativeNow,
timeStampNow,
} from '@datadog/browser-core'
import { RumPerformanceResourceTiming } from '../../../browser/performanceCollection'

Expand Down Expand Up @@ -82,6 +85,20 @@ export function computePerformanceResourceDuration(entry: RumPerformanceResource
return toServerDuration(elapsed(startTime, responseEnd))
}

if (duration > ONE_DAY) {
addMonitoringMessage('resource duration > 1 day', {
debug: {
type: entry.initiatorType,
name: entry.name,
startTime: Math.round(startTime),
responseEnd: Math.round(responseEnd),
duration: Math.round(duration),
relativeNow: Math.round(relativeNow()),
timeStampNow: timeStampNow(),
},
})
}

return toServerDuration(duration)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
import { addEventListeners, DOM_EVENT, Duration, elapsed, EventEmitter, RelativeTime } from '@datadog/browser-core'
import {
addEventListeners,
DOM_EVENT,
Duration,
elapsed,
EventEmitter,
RelativeTime,
ONE_DAY,
addMonitoringMessage,
relativeNow,
timeStampNow,
} from '@datadog/browser-core'
import { LifeCycle, LifeCycleEventType } from '../../lifeCycle'
import { trackFirstHidden } from './trackFirstHidden'

Expand Down Expand Up @@ -69,6 +80,15 @@ export function trackFirstContentfulPaint(lifeCycle: LifeCycle, callback: (fcp:
entry.name === 'first-contentful-paint' &&
entry.startTime < firstHidden.timeStamp
) {
if (entry.startTime > ONE_DAY) {
addMonitoringMessage('FCP > 1 day', {
debug: {
fcp: Math.round(entry.startTime),
relativeNow: Math.round(relativeNow()),
timeStampNow: timeStampNow(),
},
})
}
callback(entry.startTime)
}
})
Expand Down Expand Up @@ -109,6 +129,15 @@ export function trackLargestContentfulPaint(
entry.startTime < firstInteractionTimestamp &&
entry.startTime < firstHidden.timeStamp
) {
if (entry.startTime > ONE_DAY) {
addMonitoringMessage('LCP > 1 day', {
debug: {
lcp: Math.round(entry.startTime),
relativeNow: Math.round(relativeNow()),
timeStampNow: timeStampNow(),
},
})
}
callback(entry.startTime)
}
}
Expand Down
2 changes: 2 additions & 0 deletions sandbox/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
DD_RUM.init({
clientToken: 'xxx',
applicationId: 'xxx',
internalMonitoringApiKey: 'xxx',
})
DD_LOGS.init({
clientToken: 'xxx',
internalMonitoringApiKey: 'xxx',
})
</script>
</head>
Expand Down