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-1036] Add negative loading time internal monitoring #1095

Merged
merged 4 commits into from
Oct 1, 2021
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
Configuration,
ONE_SECOND,
Observable,
addMonitoringMessage,
} from '@datadog/browser-core'
import { ActionType } from '../../../rawRumEvent.types'
import { LifeCycle, LifeCycleEventType } from '../../lifeCycle'
Expand Down Expand Up @@ -138,14 +139,27 @@ class PendingAutoAction {
}

complete(endTime: TimeStamp) {
const actionDuration = elapsed(this.startClocks.timeStamp, endTime)
if (actionDuration < 0) {
addMonitoringMessage('auto action with negative loading time', {
debug: {
actionDuration,
type: this.type,
name: this.name,
startClocks: this.startClocks,
endTime,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how this information will help you to understand what's going on. The startClocks.timeStamp will always be greater than endTime, which is the issue I know, but what could we deduce from that?

Maybe storing the "clock state" in endTime instead of a timestamp alone could help, we could maybe observe that comparing timestamps produces a negative time, but comparing relative times produces a positive time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted, thanks for the advice. I'll add the end clock state.

},
})
}

const eventCounts = this.eventCountsSubscription.eventCounts
this.lifeCycle.notify(LifeCycleEventType.AUTO_ACTION_COMPLETED, {
counts: {
errorCount: eventCounts.errorCount,
longTaskCount: eventCounts.longTaskCount,
resourceCount: eventCounts.resourceCount,
},
duration: elapsed(this.startClocks.timeStamp, endTime),
duration: actionDuration,
id: this.id,
name: this.name,
startClocks: this.startClocks,
Expand Down