Skip to content
Draft
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/domain/deflate/deflate.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ export const enum DeflateEncoderStreamId {
RUM = 2,
TELEMETRY = 4,
PROFILING = 6,
REACT_PROFILING = 7,
}
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,10 @@ export type TelemetryConfigurationEvent = CommonTelemetryProperties & {
* Whether trace baggage is propagated to child spans
*/
propagate_trace_baggage?: boolean
/**
* How the SDK tracks resource request/response headers
*/
use_track_resource_headers?: 'default_headers' | 'custom'
/**
* Whether the beta encode cookie options is enabled
*/
Expand Down Expand Up @@ -981,6 +985,6 @@ export interface AndroidNetworkInstrumentation {
/**
* The network instrumentation API used
*/
type: 'CRONET' | 'OKHTTP'
type: 'CRONET' | 'OKHTTP' | 'LEGACY_OKHTTP'
[k: string]: unknown
}
11 changes: 10 additions & 1 deletion packages/rum-core/src/boot/rumPublicApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,12 @@ export function makeRumPublicApi(
strategy, // TODO: remove this in the next major release
addEvent: startRumResult.addEvent,
addError: startRumResult.addError,
profilingEndpointBuilder: configuration.profilingEndpointBuilder,
configuration,
lifeCycle: startRumResult.lifeCycle,
session: startRumResult.session,
viewHistory: startRumResult.viewHistory,
createEncoder,
})

return startRumResult
Expand Down Expand Up @@ -788,9 +794,12 @@ export function makeRumPublicApi(

setViewLoadingTime: monitor(() => {
const callTimestamp = timeStampNow()
strategy.setLoadingTime(callTimestamp)
const result = strategy.setLoadingTime(callTimestamp)
addTelemetryUsage({
feature: 'addViewLoadingTime',
no_view: result?.noView ?? false,
no_active_view: result?.noActiveView ?? false,
overwritten: result?.overwritten ?? false,
})
}),

Expand Down
34 changes: 33 additions & 1 deletion packages/rum-core/src/domain/plugins.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import type { DeflateEncoderStreamId, Encoder, EndpointBuilder } from '@datadog/browser-core'
import type { RumPublicApi, Strategy } from '../boot/rumPublicApi'
import type { StartRumResult } from '../boot/startRum'
import type { RumInitConfiguration } from './configuration'
import type { RumConfiguration, RumInitConfiguration } from './configuration'
import type { LifeCycle } from './lifeCycle'
import type { RumSessionManager } from './rumSessionManager'
import type { ViewHistory } from './contexts/viewHistory'

/**
* onRumStart plugin API options.
Expand All @@ -20,6 +24,34 @@ export interface OnRumStartOptions {
* Add a custom error to the RUM browser SDK.
*/
addError?: StartRumResult['addError']
/**
* Endpoint builder for the profiling intake. Can be used by plugins to send profiling events
* to the same endpoint as the browser CPU profiler.
*/
profilingEndpointBuilder?: EndpointBuilder
/**
* RUM configuration. Can be used by plugins to access SDK settings such as applicationId,
* profilingSampleRate, and other profiling endpoint options.
*/
configuration?: RumConfiguration
/**
* LifeCycle instance. Can be used by plugins to subscribe to RUM lifecycle events such as
* SESSION_EXPIRED, SESSION_RENEWED, and VIEW_CREATED.
*/
lifeCycle?: LifeCycle
/**
* Session manager. Can be used by plugins to find the currently tracked session.
*/
session?: RumSessionManager
/**
* View history. Can be used by plugins to find the current view context.
*/
viewHistory?: ViewHistory
/**
* Factory function to create a deflate encoder for a given stream. Can be used by plugins
* to compress profile attachments using the same encoder as the browser CPU profiler.
*/
createEncoder?: (streamId: DeflateEncoderStreamId) => Encoder
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,17 @@ export function trackCommonViewMetrics(
},
setLoadingTime: (callTimestamp?: TimeStamp) => {
if (viewEnded) {
return
return { noView: false, noActiveView: true, overwritten: false }
}
const overwritten = hasManualLoadingTime
const loadingTime = elapsed(viewStart.timeStamp, callTimestamp ?? timeStampNow())
if (!hasManualLoadingTime) {
stopLoadingTimeTracking()
}
hasManualLoadingTime = true
commonViewMetrics.loadingTime = loadingTime
scheduleViewUpdate()
return { noView: false, noActiveView: false, overwritten }
},
}
}
2 changes: 2 additions & 0 deletions packages/rum-core/src/rumEvent.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1732,6 +1732,8 @@ export interface ViewProperties {
| 'fragment_redisplay'
| 'view_controller_display'
| 'view_controller_redisplay'
| 'session_renewal'
| 'bf_cache'
/**
* Time spent on the view in ns
*/
Expand Down
Loading
Loading