ngokevin / redux-raven-middleware

:bird: Redux middleware for sending error reports to Sentry through raven-js.
MIT License
227 stars 25 forks source link

configuration option to weather or not to include the whole action #24

Closed cyberhck closed 6 years ago

cyberhck commented 7 years ago

right now, in breadcrumb, message is always action.type need to provide a configuration option, so that users can also send action, instead of just action.type.

The end goal here is to replay the bug report on our browser the exact same way user did, so reproducing the bug becomes really easy.

captbaritone commented 7 years ago

Great idea, but it has some challenges. Breadcrumbs consist of three things. A message (string), a category (string) and data (object).

More info here: https://docs.sentry.io/clients/javascript/usage/#recording-breadcrumbs

Currently this library sets the message to action.type.

I looked into passing the entire action as data but there are two limitations:

  1. data can only be one level deep. No nested objects. An action could easily have nested objects, so this won't work for our pirposes.
  2. Sentry imposes a total size limit on the amount of context you can send. So even if we worked around the flat object issue (perhaps by seeializing the action to JSON), we would still have problems. Often actions will include lots of data, like the response of an API request, so in practice it's quite easy to hit that limit if you try to record the entire action.
cyberhck commented 7 years ago

we don't have to care about nested objects, we can just do a JSON.stringify() like you said. We can attach that somehow, then I will curl the JSON endpoint, get the actions as an array, then we can use redux dev tools to replay the entire session, exactly the way user did, no surprises.

What's the size limitation on sentry? Do you happen to know about that?

Is it a limitation for one breadcrumb? or is it in total? And we only send action with payloads, not the entire state, entire state will be provided by sentry anyways.

captbaritone commented 7 years ago

@cyberhck I've added an option breadcrumbDataFromAction to my alternative middleware raven-for-redux. See the documentation for how to use it.

Unfortunately, while ideally it would be possible to record all actions and use them to exactly recreate any user bug, I think in a real world application Sentry is not quite setup to achieve this. The combination of large action payloads and long-running applications with lots of dispatched actions, will probably eventually result in hitting Sentry's limitations.

However, if you have a specific type of application where you know this will not be a problem, hopefully breadcrumbDataFromAction will allow you to do so.

cyberhck commented 7 years ago

It's sad that sentry has those limitations, with redux, bugfixing has never been easier, it's so awesome, user doesn't even have to report bug for us to be able to reproduce them. Maybe I'll look into sentry a bit more, maybe they have removed those limitations in a paid plan or something.

captbaritone commented 7 years ago

@cyberhck Here's some additional information about the size limitation from Sentry: https://github.com/getsentry/raven-js/issues/339

It looks like one option (if you're determined to get this to work) would be to run your own instance of Sentry.