Link to relevant GitLab issue from GitLab.com 500 page

When you get a 500 error on GitLab.com, we show an error page. We also send that error to Sentry, and we can link GitLab issues to Sentry. So ... if someone hits a 500 and that error already has a GitLab issue, we could link to it!

There are a bunch of moving parts here so let's start with a few:

  1. We'd need to inject the current request's correlation ID into the 500 page itself.
    1. We can't rely on it being in the headers because JavaScript can't see headers for the current page.
    2. This would be useful anyway, to help people contact support.
    3. Workhorse is probably the place for this (although I guess nginx could do it).
  2. We'd need some custom JS on the 500 page.
    1. This would just be for GitLab.com - other instances don't connect to our Sentry integration.
    2. We'd need to wait and / or poll as Sentry probably won't have processed the request as soon as the page loads.
  3. We'd need to figure out auth.
    1. You can already link to a Sentry search for a correlation ID: https://gitlab.com/gitlab-com/runbooks/blob/master/services/service-catalog.yml#L263
    2. If someone works at GitLab, and can auth to our Sentry, then that's a solid MVC.
    3. If they don't, it would still be cool to show this, but we don't want to DoS Sentry - especially as it may be busier during an incident.
Edited by Andrew Newdigate