bugsnag / bugsnag-ruby

BugSnag error monitoring & reporting software for rails, sinatra, rack and ruby
https://docs.bugsnag.com/platforms/ruby
MIT License
246 stars 174 forks source link

Mongo breadcrumb: Summarize the length of long arrays #799

Open johnnyshields opened 9 months ago

johnnyshields commented 9 months ago

Goal

In Mongo queries, it is very common to set a filter with "$in": [ some long array ] to avoid N+1 queries. Here's how this looks in the breadcrumb: image

This is a problem because:

  1. Its a ton of text
  2. It's difficult to know how many members the array actually has.

Design

To fix this, in the Mongo filter field, an Array which (a) has more than 3 members and (b) does not contain nested Arrays or Hashes will be summarized as ["LENGTH=42"] (e.g. if it has 42 members)

Changeset

Only changes the Mongo breadcrumb functionality.

This also includes the changes from:

Testing

Tested in RSpec and by TableCheck in production.

clr182 commented 9 months ago

Hi @johnnyshields Thanks for raising this PR. We will be sure to take a look when priority allows us.