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 Request: Filter errors #78

Open
dheeraj-jn opened this issue Mar 31, 2023 · 2 comments
Open

Feature Request: Filter errors #78

dheeraj-jn opened this issue Mar 31, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@dheeraj-jn
Copy link

dheeraj-jn commented Mar 31, 2023

Allow to pass a callback to the initialize method to filter the logs to be sent.
Use case: to avoid a deluge of false positive errors and benign issues.

Example usage:

window.sumoLogicOpenTelemetryRum.initialize({
  // ...
  collectErrors: true,
  filterLog: (log: LogRecord) => {
    if (log.message.includes('foo')) {
      return undefined; // returning undefined will filter out this log
    }
    log.message = 'Bar ' + log.message; // optional: can modify log
    return log; // return modified log to be used
  }
});

This can be called in recordLog:

  recordLog(log: LogRecord) {
    const newLog = this.filterLog(log);
    if (newLog === undefined) {
      return;
    }
    // ...
  }
@TRybakSUMO
Copy link
Contributor

Hi @dheeraj-jn, thanks for the proposition, I think we will be able to address your request in the next release. Stay tuned!

@TRybakSUMO TRybakSUMO added the enhancement New feature or request label Apr 27, 2023
@TRybakSUMO TRybakSUMO self-assigned this Apr 27, 2023
@dheeraj-jn
Copy link
Author

@TRybakSUMO that's great to know! Awaiting the release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants