oppia / foundation-website

Repository for developing the new Oppia Foundation website.
Apache License 2.0
6 stars 33 forks source link

Throttle errors on the Foundation site #91

Closed seanlip closed 6 years ago

seanlip commented 6 years ago

Per discussion with @hoangviet1993, let's throttle errors, similar to https://github.com/oppia/oppia/pull/5767

hoangviet1993 commented 6 years ago

@seanlip

I am trying to brainstorm different approaches to this problem of error spamming. This SO answer raises an interesting solution https://stackoverflow.com/questions/26271024/what-is-a-good-backoff-algorithm-for-throttling-logging-of-errors

Another way would be to enqueue the log somewhere in memory and de-duplicate on a timer. For example, every ten seconds you could count the number of occurrences of each message and log them all

Instead of putting exceptionHandler on a 5 second cool-down, here is a simplified algorithm

1) Store these stack-traces on localStorage 2) Count the number of occurrences and de-duplicate them (this might be complicated?!) 3) Similar to the changes in your PR, if 10 seconds have occurred since the last exception logged, send the compiled list of different errors and the number of its occurrences.

I know all of these stuff sounds like over-engineering for a simple problem of preventing spam from error logging. I would like to try to be exhaustive in solving this problem so pardon my over-thinking!

seanlip commented 6 years ago

No problem! Analysis is good :)

However, I think we don't need a complex solution to this problem, and the existing simple-minded one will do. I would go with whatever has the simplest code for now, unless there's a compelling reason to do otherwise.

hoangviet1993 commented 6 years ago

That is fair! I will be mirroring your changes in my PR then. Thanks!

hoangviet1993 commented 6 years ago

Issue fixed by PR #92. Closing this issue!