Skip to content

Expose rrweb replay hooks in @hyperdx/browser so recordCanvas can be debounced or filtered #253

@chrismcdev

Description

@chrismcdev

Summary

@hyperdx/browser exposes recordCanvas and sampling, but it does not appear to expose rrweb replay hooks such as hooks.canvasMutation.

That makes recordCanvas hard to use with drawing-heavy apps, because canvas tools like Excalidraw, Konva, whiteboards, signature pads, and graphing tools can generate a very large number of CanvasMutation events while the user is drawing.

Problem

When recordCanvas: true is enabled, a single drawing interaction can emit a very large stream of replay events.

For many apps, the desired behavior is not to record every stroke or frame, but instead to:

  • capture the final canvas state
  • debounce canvas updates until the user stops drawing
  • allow filtering or coalescing of CanvasMutation events

Right now, this does not seem possible from @hyperdx/browser alone.

Why this matters

Without recordCanvas, canvas-based UIs replay as blank or incomplete.

With recordCanvas, event volume can become too high to use comfortably.

sampling does not solve this well because the noisy part is specifically canvas mutation traffic, not the standard mousemove, scroll, or input sampling categories.

Requested behavior

Please expose rrweb recorder hooks, or a recorder options passthrough from @hyperdx/browser, so consumers can do things like:

  • debounce hooks.canvasMutation
  • suppress intermediate canvas events
  • resume publishing only after a quiet period
  • implement custom filtering or coalescing for canvas-heavy apps

Example of desired API

For example, an API shaped roughly like this would unblock the use case:

HyperDX.init({
  apiKey: "...",
  service: "...",
  recordCanvas: true,
  replay: {
    hooks: {
      canvasMutation() {
        // consumer-defined debounce / coalescing logic
      },
    },
  },
});

Or a direct passthrough of the lower-level recorder config, if that is more appropriate.

Current workaround

The current workaround is to:

  1. Initialize @hyperdx/browser with disableReplay: true
  2. Initialize @hyperdx/otel-web-session-recorder manually
  3. Use raw rrweb hooks there

That works, but it defeats the convenience of @hyperdx/browser as the high-level browser SDK.

Reproduction

A minimal repro is any app with a canvas drawing tool enabled and:

HyperDX.init({
  apiKey: "...",
  service: "...",
  recordCanvas: true,
});

Then draw continuously for a few seconds and inspect replay event volume.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions