Skip to content

Check the actual bytesize of a Sentry JSON payload

Peter Leitzen requested to merge pl-error-tracking-fix-sentry-client-limit into master

What does this MR do and why?

Fixes #393029 (closed).

Since the bytes size of a JSON payload is different from what DeepSize calculates which is Ruby's object size, this MR changes the size validation by checking both the JSON payload size and, if that passes validation, then checks the size computed by DeepSize.

Screenshots or screen recordings

Screenshots (redacted) of failed requests only. Success requests are still working!

As a follow-up, we could present the distinct error messages to users.

Failed requests
Screenshot_from_2024-01-26_14-31-08
Screenshot_from_2024-01-26_14-37-14
Screenshot_from_2024-01-26_14-39-46
Screenshot_from_2024-01-26_14-40-46

How to set up and validate locally

  1. Setup Error Tracking for Sentry host
  2. Access errors via Monitor > Error Tracking
  3. No errors
  4. Tweak RESPONSE_SIZE_LIMIT = 1.megabyte in lib/error_tracking/sentry_client.rb and restart background jobs gdk restart rails-background-jobs
  5. Observes errors to show up!

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 Peter Leitzen

Merge request reports