Skip to main content

Agent Configuration

The system can dynamically send some advanced configurations to the agent. Detailed configuration items and descriptions are as follows.

// Description of externally provided configuration items
export type ReportConfigOptions = {
// Environment, default: none
env?: string
// Application version, default: none
release?: string
// Common configuration
common?: {
// Agent debug switch, default: false
debug?: boolean
// Session mode, default: auto
sessionMode?: 'auto' | 'manual'
// Force specify the data protocol to send, default: none
sendProtocol?: string
}
// Page monitoring configuration
page?: {
// Monitor route loading, default: true
routerEnabled?: boolean
// Specify the monitored routing mode, default: auto
routerMode?: 'history' | 'hash' | 'auto'
// Default waiting time for route loading operation, unit: ms, default: 500
routerOperationDelay?: number
// Upload hash route switching without ajax, default: false
uploadNoAjaxHashRouter?: boolean
// Default waiting time without ajax during loading, unit: ms, default: 500
pageLoadDelay?: number
// Whether to use lcp as first screen, default: true
lcpAsFs?: boolean
// Whether to enable mutationObserver monitoring, default: true
mutationEnabled?: boolean
// When not using lcp to calculate the first screen, set the image resources on the first screen line, default: none
fsResources?: string[]
}
// Ajax monitoring configuration
ajax?: {
// Ajax monitoring master switch, default: true
enabled?: boolean
// Ajax xhr monitoring switch, default: true
xhrEnabled?: boolean
// Ajax fetch monitoring switch, default: true
fetchEnabled?: boolean
// mPaas monitoring switch, default: true
mPaaSEnabled?: boolean
// Monitor xhr's setRequestHeader interface, default: true
hookXhrSetRequestHeader?: boolean
// Ajax blacklist, default: none
ignoreUrls?: string[]
}
// JS error monitoring configuration
jsError?: {
// Whether to monitor JS errors, default: true
enabled?: boolean
// Whether to report js errors with empty file names, default: false
uploadEmptyFileErrors?: boolean
// Whether to try catch asynchronous callback functions, default: false
catchAsyncCallback?: boolean
}
// Operation data
operation?: {
// User operation automatic monitoring switch, default: true
enabled?: boolean
// Whether to monitor callbacks bound to onclick, onsubmit attributes on html tags, default: true
inlineEventEnabled?: boolean
// Whether to hook onXXX (onclick, onsubmit) properties in HTMLElement.prototype, default: true
onPropertyEnabled?: boolean
// Whether to hook addEventListener/removeEventListener, default: true
eventListenerEnabled?: boolean
// Inline event association threshold for subordinate requests, unit: ms, default: 200
inlineEventThreshold?: number
// Whether to enable automatic cross-page events, default: true
crossPageEnabled?: boolean
// Whitelist of elements such as Ajax iframe under operation, default: none
itemUrls?: string[]
// Blacklist of elements such as Ajax iframe under operation, default: none
ignoreItemUrls?: string[]
// Operation timeout, unit: ms, default: 60000
timeout?: number
// Threshold for time difference after elements under operation are mounted to ajax callback, unit: ms, default: 100
resourceAssociationThreshold?: number
// Maximum waiting time for loading elements mounted to ajax under operation, unit: ms, default: 10000
resourceAssociationWaitTime?: number
}
// APM configuration
requestTracing?: {
// Whether to actively add apm request headers, default: false
autoAddApmHeader?: boolean
}
// Element loading monitoring
resource?: {
// Whether to monitor iframe loading, default: true
iframeEnabled?: boolean
}
// Configuration refresh
configReload?: {
// Server-side configuration acquisition switch, default: true
enabled?: boolean
// Configuration expiration duration, unit: minutes, default: 10
expire?: number
}
// Web Vitals metrics collection
webVitals?: {
// Master switch, default: true
enabled?: boolean
// webvitals lcp switch, default: true
lcpEnabled?: boolean
// webvitals fid switch, default: true
fidEnabled?: boolean
// webvitals cls switch, default: true
clsEnabled?: boolean
// webvitals ttfb switch, default: true
ttfbEnabled?: boolean
// webvitals fcp switch, default: true
fcpEnabled?: boolean
}
// Video recording plugin configuration
replay?: {
// Privacy mode standard / strict, default is standard mode
privacyMode?: string
// Mask configuration
blockClass?: string[]
// Obfuscation configuration
maskTextClass?: string[]
// Ignore input configuration
ignoreClass?: string[]
}
}