-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c027125
commit 2d9d55c
Showing
14 changed files
with
80 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 0 additions & 31 deletions
31
packages/rum-core/src/domain/rumEventsCollection/view/addWebVitalTelemetryDebug.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
packages/rum-core/src/domain/rumEventsCollection/view/startWebVitalTelemetryDebug.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { addTelemetryDebug, elapsed, noop, performDraw, relativeNow, toServerDuration } from '@datadog/browser-core' | ||
import type { Telemetry, RelativeTime } from '@datadog/browser-core' | ||
import type { RecorderApi } from '../../../boot/rumPublicApi' | ||
import type { RumSessionManager } from '../../rumSessionManager' | ||
import type { RumConfiguration } from '../../configuration' | ||
|
||
export type WebVitalTelemetryDebug = ReturnType<typeof startWebVitalTelemetryDebug> | ||
|
||
export function startWebVitalTelemetryDebug( | ||
configuration: RumConfiguration, | ||
telemetry: Telemetry, | ||
recorderApi: RecorderApi, | ||
session: RumSessionManager | ||
) { | ||
const webVitalTelemetryEnabled = telemetry.enabled && performDraw(configuration.customerDataTelemetrySampleRate) | ||
|
||
if (!webVitalTelemetryEnabled) { | ||
return { | ||
addWebVitalTelemetryDebug: noop, | ||
} | ||
} | ||
return { | ||
addWebVitalTelemetryDebug(webVitalName: string, webVitalNode: Node | undefined, webVitalTime: RelativeTime) { | ||
const computationTime = relativeNow() | ||
if (!recorderApi.isRecording()) { | ||
recorderApi.recorderStartObservable.subscribe((recordingStartTime) => { | ||
addTelemetryDebug(`${webVitalName} attribution recording delay`, { | ||
computationDelay: toServerDuration(elapsed(webVitalTime, computationTime)), | ||
recordingDelay: toServerDuration(elapsed(webVitalTime, recordingStartTime)), | ||
hasNode: !!webVitalNode, | ||
serializedDomNode: webVitalNode ? recorderApi.getSerializedNodeId(webVitalNode) : undefined, | ||
}) | ||
}) | ||
} | ||
|
||
addTelemetryDebug(`${webVitalName} attribution`, { | ||
computationDelay: toServerDuration(elapsed(webVitalTime, computationTime)), | ||
hasNode: !!webVitalNode, | ||
replayRecording: recorderApi.isRecording(), | ||
replaySampled: session.findTrackedSession()?.sessionReplayAllowed, | ||
serializedDomNode: webVitalNode ? recorderApi.getSerializedNodeId(webVitalNode) : undefined, | ||
}) | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.