-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Truncate long strings in large payloads to respect 128kb limit #38
Comments
@brianr I need a bit more explanation on what needs to be done here:
|
Also, the rollbar-gem example you provided seems to not be up to date (lines 400-410 are not there anymore). Can you point me to where this resides now? |
Here's a more up-to-date link - https://github.com/rollbar/rollbar-gem/tree/master/lib/rollbar/truncation cc @rokob for direction on how to proceed with truncation. |
The API will reject requests that are too large: https://rollbar.com/docs/api/items_post/#response-codes
The docs say 128kb, the reality is that the entire entity-body of the post request must be below 1MB. That is, the Content-Length as defined by: "Content-Length entity-header field indicates the size of the entity-body, in decimal number of OCTETs" must be less than 1MB. What this means in practice is that if the payload itself is too large, we need to truncate some things to get it below the desired threshold. We want to truncate strings that are values in the request body (i.e. not keys in a JSON object). The way the gem decides to do this, is to pick a max payload size of 0.5 MB (https://github.com/rollbar/rollbar-gem/blob/bf6d439be15455b557886fc73304ba00303aa278/lib/rollbar/truncation.rb#L12), and then to apply strategies in order until the payload satisfies this size limit: https://github.com/rollbar/rollbar-gem/blob/bf6d439be15455b557886fc73304ba00303aa278/lib/rollbar/truncation.rb#L22-L25 Those strategies https://github.com/rollbar/rollbar-gem/tree/bf6d439be15455b557886fc73304ba00303aa278/lib/rollbar/truncation start with some conservative truncations such as removing the middle of the stack trace if there are an excessive number of frames, and get more aggressive as the payload continues to be too large. There is a bit of flexibility in how to do the truncation, but the main rules are:
The strategies in the gem try to only remove data for very long strings or excessively large stack traces, and if that doesn't work, they truncate further. |
This sounds like it's going to take much longer than six hours I provided in the initial estimate |
Merged |
rollbar-gem does this: https://github.com/rollbar/rollbar-gem/blob/master/lib/rollbar.rb#L400-L410 . We should do something similar here.
The text was updated successfully, but these errors were encountered: