class ScoutApm::LayerChildrenSet

A set of children records for any given Layer. This implements some rate-limiting logic.

We store the first ‘unique_cutoff` count of each layer type. So if cutoff is 1000, we’d store 1000 HTTP layers, and 1000 ActiveRecord calls, and 1000 of each other layer type. After that, make a LimitedLayer object and store only aggregate counts and times of future layers of that type. (So the 1001st an onward of ActiveRecord would get only aggregate times, and counts, without any detail about the SQL called)

When the set of children is small, keep them unique When the set of children gets large enough, stop keeping details

The next optimization, which is not yet implemented:

when the set of children gets larger, attempt to merge them without data loss