Skip to content

Make Puma low-level handler send to all available Sentry instances

Stan Hu requested to merge sh-improve-puma-lowlevel-handler into master

What does this MR do and why?

Previously the Puma low-level handler would only send to the legacy Sentry client (Raven). This change updates the logic to use Gitlab::ErrorTracking so that both new and legacy clients will receive exceptions. In addition, the message will also be logged in exceptions_json.log. Gitlab::ErrorTracking has been updated to support custom tags.

How to set up and validate locally

  1. In the Rails console, enable the new Sentry integration:

    Feature.enable(:configure_sentry_in_application_settings)
    Feature.enable(:enable_new_sentry_integration)
  2. In /admin -> Settings -> Metrics and Reporting -> Sentry, configure a Sentry DSN. I used the settings from https://new-sentry.gitlab.net/organizations/gitlab/projects/gitlab-test-instances/?project=31. Be sure check Enable Sentry for Rails and Browser JavaScript. (I think that should be simplified to say Enable Sentry).

  3. Check out this branch and gdk restart rails.

  4. To trigger the Puma low-level handler, send a HTTP request to your GDK (to Puma, not NGINX) with a large header. For example, I used:

URL="http://localhost:3000"

large_header=""

for ((i=1; i<=50; i++)); do
  large_header+="X-Custom-Header$i: $(openssl rand -base64 100)\r\n"
done

# Send the HTTP request with the large header using curl
curl -v -X GET -H "$large_header" "$URL"
  1. Now check log/exceptions_json.log and the Sentry project for issues.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Stan Hu

Merge request reports