Skip to content

[Replay] Move rrweb-specific configuration into recordingOptions #6390

Closed
@mydea

Description

@mydea

Currently, replay is configured like this:

new Replay({
  // replay specific config
  useCompression: true,
  stickySession: true,

  // this is passed directly to rrweb
  blockClass: 'sentry-block',
  ignoreClass: 'sentry-ignore',
  maskTextClass: 'sentry-mask'
});

From a code perspective, this happens with a rest operator:

constructor({
    flushMinDelay = 5000,
    flushMaxDelay = 15000,
    initialFlushDelay = 5000,
    stickySession = true,
    useCompression = true,
    sessionSampleRate = DEFAULT_SESSION_SAMPLE_RATE,
    errorSampleRate = DEFAULT_ERROR_SAMPLE_RATE,
    maskAllText = true,
    maskAllInputs = true,
    blockAllMedia = true,
    blockClass = 'sentry-block',
    ignoreClass = 'sentry-ignore',
    maskTextClass = 'sentry-mask',
    blockSelector = '[data-sentry-block]',
    ...recordingOptions, // <-- this is the important part
  }: ReplayConfiguration = {}) {

This basically means that any config passed to new Replay() that is not defined above will be passed to rrweb.

In order to streamline this and make this more explicit, I propose to change this API to:

new Replay({
  // replay specific config
  useCompression: true,
  stickySession: true,

  recordingOptions: {
    blockClass: 'sentry-block',
    ignoreClass: 'sentry-ignore',
    maskTextClass: 'sentry-mask'
  }
});

This would make it much more explicit which options are only related to rrweb.
We can still promote all options we care about/think are important to the top level and internall pass them to recordingOptions, e.g.:

new Replay({
  // replay specific config
  useCompression: true,
  stickySession: true,

  // Explicit rrweb options we care about - name can match, but could also be different
  blockClass: 'myClass',
  otherNameForIgnoreClass: 'ignore'

  recordingOptions: {}
});

For now, I propose to add these options to the top level:

  • ignoreClass: string | string[] one or multiple classes to ignore. We can internally convert this for ignoreClass
  • blockClass: string | string[]: one or multiple classes to block
  • blockSelector: string | string[]: One or multiple selectors to block
  • maskTextClass: string | string[]: one or multiple classes to mask text for
  • inlineImages: If true, inline images as data URIs
  • recordCanvas: If true, record canvas element content

Which covers the most relevant stuff, and also the stuff we currently provide default values for.

For the initial release, we can still handle the "old" way of config, warn when we detect "unknown" config, and still make it work. And then remove this deprecated functionality in the near future.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions