You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because of the order of operations in the .truncate method the Rollbar gem will choose a short backtrace using MinBodyStrategy, then if the payload is still too large it will throw away the request using RemoveRequestStrategy. But in the case of a very large request the old backtrace wouldn't necessarily have been too big on its own. It's also not clear if the payload is supposed to be mutated between strategies. It seems like there are a few ways to go with this algorithm:
Don't mutate the payload between strategies. Or maybe first try each strategy in a non-mutating way and then use a cumulative/mutating approach if that fails.
Put RemoveRequestStrategy before MinBodyStrategy
Put RemoveRequestStrategy before MinBodyStrategy and make RemoveRequestStrategy truncate individual keys in the request parameters to see if it will fit.
Some sort of approach where all permutations of different strategies are compared for the one that gets closest to the limit.
The text was updated successfully, but these errors were encountered:
I would be in favor of allowing custom ordering (and removal) of strategies via the config, as well as allowing custom strategies.
Another thing that may help in your case, or for others. In practice, Rails backtraces are one of the biggest causes of large payloads. Recent support for Backtrace Cleaner can help with that. (Discussed here. https://docs.rollbar.com/docs/ruby#enabling-local-variables-in-stack-traces) It is smarter than the current backtrace strategy in the truncation code, and can be customized.
Looking at this code:
rollbar-gem/lib/rollbar/truncation.rb
Line 20 in a294430
Because of the order of operations in the
.truncate
method the Rollbar gem will choose a short backtrace usingMinBodyStrategy
, then if the payload is still too large it will throw away the request usingRemoveRequestStrategy
. But in the case of a very large request the old backtrace wouldn't necessarily have been too big on its own. It's also not clear if the payload is supposed to be mutated between strategies. It seems like there are a few ways to go with this algorithm:RemoveRequestStrategy
beforeMinBodyStrategy
RemoveRequestStrategy
beforeMinBodyStrategy
and makeRemoveRequestStrategy
truncate individual keys in the request parameters to see if it will fit.The text was updated successfully, but these errors were encountered: