datadog-ux-utils Documentation - v1.0.0
    Preparing search index...

    Type Alias RenderDetectorOptions

    Options controlling when a subtree is considered a render hotspot.

    type RenderDetectorOptions = {
        enabled?: boolean;
        windowMs?: number;
        commitsPerSecThreshold?: number;
        renderMsPerSecThreshold?: number;
        minCommits?: number;
        cooldownMs?: number;
        telemetrySampleRate?: number;
        telemetryActionName?: string;
        onHotspot?: (info: HotspotInfo) => void;
        includeProfilerDetails?: boolean;
        context?: Record<string, unknown>;
    }
    Index

    Properties

    enabled?: boolean

    Enable the detector. Default:

    • In development: true
    • In production: false
    windowMs?: number

    Size of the sliding window (in milliseconds) over which commit metrics are computed. Default: 2000ms (2 seconds).

    commitsPerSecThreshold?: number

    Threshold for commits per second that flags a hotspot. Example: if set to 5, more than 5 commits/sec within the window triggers. Default: 5 commits/sec.

    renderMsPerSecThreshold?: number

    Threshold for total render time per second (in milliseconds) that flags a hotspot. Example: if set to 24, more than 24ms of render work per second within the window triggers. Default: 24ms/sec (roughly > 40% of a 60fps frame budget).

    minCommits?: number

    Minimum number of commits within the window before evaluating thresholds. Prevents noise from one-off commits. Default: 3 commits.

    cooldownMs?: number

    Cooldown period (ms) after a hotspot is reported before reporting again for the same detector. Default: 5000ms (5s).

    telemetrySampleRate?: number

    Optional sample rate (0–100) for sending telemetry to DataDog via addAction. Default: 20 (%). Set to 0 to disable telemetry.

    telemetryActionName?: string

    Action name emitted to DataDog when a hotspot is detected. Default: "render_hotspot".

    onHotspot?: (info: HotspotInfo) => void

    Optional callback invoked when a hotspot is detected. Use this to log locally, show a dev toast, etc.

    includeProfilerDetails?: boolean

    Include React Profiler baseDuration and phase in telemetry. Default: true. If false, only time-based aggregates are sent.

    context?: Record<string, unknown>

    Arbitrary static context to include on every hotspot report. (Kept shallow to avoid heavy serialization.)