Sentry: Improve (or allow custom?) issue grouping rules

Created on 20 Mar 2018  Â·  5Comments  Â·  Source: getsentry/sentry

My team is paying for, and using the sentry.io hosted version of this product.

Motivation

We often find that Sentry's preference for grouping exceptions by Stack Trace is ill-suited to our use cases.

As an example, in our JS-side exception logging, our stack trace will almost always include a reference to the active URL (we use client-side routing, so this lives in JS-client state). This is an issue, because many URLs include user-generated IDs or other dynamic properties. Therefore for many classes of exceptions, the Stack Trace is almost guaranteed to be unique on every single instance.

Merging issues is useful, but in cases like the above, we may end up with thousands of unique instances of the same issue before we can catch and resolve it.

Suggestions

I'm sure there are a lot of approaches to this. Here are some of my ideas:

  • Maybe the approach most inline with Sentry's current approach would be to look for and ignore discrepencies in URLs that might occur? Alternatively use a heuristic to scrub IDs from a stack trace?
  • It would be great if we could somehow apply our own rules for grouping — something like email inbox filters, maybe?
  • Or, alternatively, maybe simply specify some issues we'd prefer to group by message, instead of stack trace?

Here are some sample stack traces. Note that the only difference occurs in the very last line:

InvariantViolation: HandwritingPanelWithConfig was mounted for a problem type other than LatexAnswer
  at call([native code])
  at InvariantViolation(./ms-utils/appLogging/index.jsx:14:34)
  at B(/static/cache/r2630/build/ms-pages/Work-369d6831b8229c055c35.js:1:61354)
  at rg(../node_modules/react-dom/cjs/react-dom.production.min.js:133:308)
  at d(../node_modules/react-dom/cjs/react-dom.production.min.js:161:87)
  at f(../node_modules/react-dom/cjs/react-dom.production.min.js:161:414)
  at g(../node_modules/react-dom/cjs/react-dom.production.min.js:162:149)
  at m(../node_modules/react-dom/cjs/react-dom.production.min.js:169:88)
  at w(../node_modules/react-dom/cjs/react-dom.production.min.js:168:412)
  at rc(../node_modules/react-dom/cjs/react-dom.production.min.js:171:345)
  at tc(../node_modules/react-dom/cjs/react-dom.production.min.js:54:262)
  at vd(../node_modules/react-dom/cjs/react-dom.production.min.js:71:249)
  at je([native code])
  at wrapped(../node_modules/raven-js/src/raven.js:360:1)
  at nrWrapper(/work/AdaptiveWorkout-****2329-****31:6:11782)
InvariantViolation: HandwritingPanelWithConfig was mounted for a problem type other than LatexAnswer
  at call([native code])
  at InvariantViolation(./ms-utils/appLogging/index.jsx:14:34)
  at B(/static/cache/r2630/build/ms-pages/Work-369d6831b8229c055c35.js:1:61354)
  at rg(../node_modules/react-dom/cjs/react-dom.production.min.js:132:491)
  at d(../node_modules/react-dom/cjs/react-dom.production.min.js:161:87)
  at f(../node_modules/react-dom/cjs/react-dom.production.min.js:161:414)
  at g(../node_modules/react-dom/cjs/react-dom.production.min.js:162:149)
  at m(../node_modules/react-dom/cjs/react-dom.production.min.js:169:88)
  at w(../node_modules/react-dom/cjs/react-dom.production.min.js:168:412)
  at rc(../node_modules/react-dom/cjs/react-dom.production.min.js:171:345)
  at tc(../node_modules/react-dom/cjs/react-dom.production.min.js:54:262)
  at vd(../node_modules/react-dom/cjs/react-dom.production.min.js:71:249)
  at je([native code])
  at wrapped(../node_modules/raven-js/src/raven.js:360:1)
  at nrWrapper(/work/FastTrackWorkout-****66:6:11782)

Most helpful comment

This is how we solved it:

Sentry.init({
  ...other config...,
  integrations: [
      new Sentry.Integrations.RewriteFrames({
        iteratee: function (frame) {
          // This is un-related to ignoring NewRelic, but good to have to show the "App Only" thing in Sentry
          frame.in_app = frame.filename.includes(window.location.hostname) && !frame.filename.includes('/vendor.');
          // This stops NewRelic from causing the stack trace to be different on every single page.
          if (/nrWrapper/.test(frame.function)) {
            frame.filename = '?';
            frame.lineno = 0;
            frame.colno = 0;
            frame.in_app = false;
          }
          return frame;
        }
      })
  ],
)

All 5 comments

We are also a paying customer and have the exact same issue.

We are having the same issue, and it appears that the issue is because we have New Relic browser installed as well.

the nrWrapper is an inline script, so it includes the URL of the page, meaning we get an issue for every page.

Can we please get a way to ignore the URL of an inline script when grouping? or some way for Sentry to work nicer with new relic?

This is how we solved it:

Sentry.init({
  ...other config...,
  integrations: [
      new Sentry.Integrations.RewriteFrames({
        iteratee: function (frame) {
          // This is un-related to ignoring NewRelic, but good to have to show the "App Only" thing in Sentry
          frame.in_app = frame.filename.includes(window.location.hostname) && !frame.filename.includes('/vendor.');
          // This stops NewRelic from causing the stack trace to be different on every single page.
          if (/nrWrapper/.test(frame.function)) {
            frame.filename = '?';
            frame.lineno = 0;
            frame.colno = 0;
            frame.in_app = false;
          }
          return frame;
        }
      })
  ],
)
Was this page helpful?
0 / 5 - 0 ratings