Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Configuration for capturing "Console" and "Network" data #7463

Closed
billyvg opened this issue Mar 14, 2023 · 1 comment
Closed

Feature: Configuration for capturing "Console" and "Network" data #7463

billyvg opened this issue Mar 14, 2023 · 1 comment

Comments

@billyvg
Copy link
Member

billyvg commented Mar 14, 2023

Problem

Some users want to be able to control what gets captured in the Console and Network tabs (for example, privacy reasons).

We should add configuration options to replay to:

  • enable/disable capturing of Console messages
  • enable/disable capturing of Network data
  • capture specific console log levels (log, info, debug, warn, error)
  • capture specific network types (css, script, img, link, fetch, xhr, other)

Proposal

I'm not familiar with other parts of the SDK but this API should be consistent with existing patterns if possible:

Single key

new Replay({
  captureConsole: true,      // Default, capture everything
  captureConsole: false,     // Do not capture any console logs
  captureConsole: ['error'], // Capture only `console.error()`
});

Multiple keys

new Replay({
  disableCaptureConsole: false, // Default, capture everything
  disableCaptureConsole: true,  // Do not capture any console logs
  captureConsole: ['error'],    // Capture only `console.error()`
});
@billyvg
Copy link
Member Author

billyvg commented Jun 1, 2023

This can be closed by a low level API added in #8124

new Sentry.Replay({
  beforeAddRecordingEvent: (event) => {
    // Filter out specific events
    if (event.data.payload.category === 'console') {
      return null;
    }

    // Remember to return an event if you want to keep it!
    return event;
  }
});

@billyvg billyvg closed this as completed Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant