Page MenuHomePhabricator

Create error logging JS module
Closed, ResolvedPublic

Description

Create an mw.errorLog ResourceLoader module in core. The module should have two entry points:

  • logException takes an exception (and optionally additional data) and reports it to the server.
  • logError takes the same arguments as window.onerror and reports them to the server.

Reporting to the server means composing an error object, and sending it via one of these methods:

  • AJAX request to a configurable endpoint
  • GET parameters of a HTTP request to a configurable endpoint (with a fake image, the same way EventLogging does it)
  • configurable callback function
  • log to console

The method and endpoint/callback should be configurable in LocalSettings. There should also be a configuration variable to automatically call the logger from window.onerror.

At this point, it is OK to assume exceptions and onerror events behave the way they do in modern browsers. Unexpected input should not cause a new error, though.

The entry points should return an error id that can help the user to find or report the error. At this point it is fine to just return a random token (eventually this will be something like the hash of the error location). The error id should be reported home along with all other error data.

Document the concept, functionality and configuration settings on mw.org.

Event Timeline

Tgr raised the priority of this task from to 0.
Tgr updated the task description. (Show Details)
Tgr added a project: Architecture.
Tgr changed Security from none to None.
Tgr subscribed.
Tgr raised the priority of this task from 0 to Unbreak Now!.
Tgr lowered the priority of this task from Unbreak Now! to Medium.
Tgr removed Tgr as the assignee of this task.Jan 30 2015, 2:38 AM

to push forward on Sentry, we have to sort of do this and T500 at the same time. So let's start here. Two options:

  • new extension, something like ClientErrorLogging, very similar in code architecture to how EventLogging works
  • add a new independent module to EventLogging, something like ext.eventLogging.errorLogging

Thoughts?

A very minimal error handler has been added to core: mediawiki.errorLogger.js. It doesn't do anything beyond pushing exceptions on an mw.track channel.
The rest was written as Extension:Sentry which uses the Sentry client library to report those exceptions. This was done four years ago so the frontend code is very outdated. We might or might not want to use the Sentry library anyway - it can canonicalize stack traces which is nice, but initially we don't need stack traces (and can't have useful traces anyway due to lack of source map support in ResourceLoader), and it is fairly large. @phuedx or the Reading Web team are probably better people to coordinate with on this.

Ok, thanks very much Gergo, looks like Sam set up a meeting for next week, we'll take it from there. Once I understand better how I can help, we should clean up these phab tasks.

What's the current status of this and other related tasks now we are rolling out our own error handler?

See T255585: Extend client-side error logging coverage

Tgr assigned this task to jlinehan.
Tgr added a subscriber: jlinehan.

@jlinehan wrote a replacement for the Sentry code, so there is nothing left to do here.

See T255585: Extend client-side error logging coverage

I closed the subtasks of T382: RfC: Server-side Javascript error logging which have been done in T226986: Client side error logging production launch. The rest are still relevant, I think. There are a few related to capabilities of the logging script (e.g. T514 or T508) which might have been done, I'd have to check the implementation. Also not sure about T522: Add JS error counts to graphite, I seem to recall there is a grafana board now, but maybe I'm making that up?