Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Add option to filter out breadcrumbs #294

Open
emmenko opened this issue Mar 14, 2017 · 2 comments
Open

Add option to filter out breadcrumbs #294

emmenko opened this issue Mar 14, 2017 · 2 comments

Comments

@emmenko
Copy link

emmenko commented Mar 14, 2017

Do you want to request a feature or report a bug?
This is a feature request.

Has someone had this problem before?
I haven't found anything similar in the issue tracker.

What is the current behavior?
At the moment, breadcrumbs are collected for e.g. all http requests, all console logs, etc.

What is the expected behavior?
I'm using the latest version 1.1.4.


The breadcrumb feature is really great, I love it!
However it would be really nice if we can specify some kind of filters for "tracking" the breadcrumb or not (e.g. some http requests should / must not be tracked, etc).

I think something like this should be enough:

Raven.config('https://[email protected]/123', {
  autoBreadcrumbs: {
    // pass a function that returns a boolean if you want to filter out some of them
    http: (breadcrumb) => {
      // filter out all GET methods
      return breadcrumb.method !== GET
      // filter out breadcrumbs matching a specific route
      return !/\/login/.test(breadcrumb.url)
      // and so on, depending on the available fields
      // https://github.com/getsentry/raven-node/blob/fa3aa077410346530bbff82956fb9f022b0121d4/lib/breadcrumbs.js#L96-L99
    },
    // pass a boolean to simply enable/disable all breadcrumbs for console
    console: true,
  }
})

Thanks a lot for the help!

@LewisJEllis
Copy link
Contributor

LewisJEllis commented Mar 14, 2017

Hi @emmenko! Great point to bring up. The browser JS SDK, raven-js, has roughly the functionality you're describing in the form of the breadcrumbCallback option (docs, pr), but raven-node does not.

There's sort of a bigger picture "events and filtering" ongoing discussion that this ties into so we didn't immediately add a corresponding breadcrumbCallback option to raven-node, but I wouldn't be against doing that if it would be useful; it can cover until we have a more permanent resolution on filter-callbacks/events emitted/etc. Take a look at the raven-js functionality and let me know if it's what you have in mind or if there's anything more to what you're imagining.

@emmenko
Copy link
Author

emmenko commented Mar 14, 2017

Ah cool, I missed that in raven-js. As far as I can see that is more or less what I imagined and should perfectly do the job 👍

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants