Skip to content
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

Better locals data, and truncation improvements #922

Merged
merged 2 commits into from
Dec 17, 2019

Conversation

waltjones
Copy link
Contributor

Improvements related to: #117

Previously, locals were added to the payload by calling #to_s on each object. With this update, hashes and arrays are traversed. Then all types except strings and immediates are exported using #inspect. (Sending the object itself to the serializer can result in large recursive expansions after truncation has already run. Other export options could be #to_s, #to_h, and #as_json. Several of these will omit the class name, or are not implemented for many types.)

#inspect has the advantage that it is specifically intended for debugging output. If the user wants more or different information in the payload about a specific type, #inspect is the correct place to implement it. Likewise the default implementation of #inspect for any type should already be oriented toward usefulness in debugging.

Because #inspect outputs a string, it can be handled well by the string truncation strategy for large payloads.

Truncation improvements

The Frames and Strings strategies are designed to preserve as much data as possible. However if these fail, the remaining strategies can have a severe impact on the usefulness of the payload. It is better to let the Frames and Strings strategies be more aggressive and avoid the later strategies.

  • Trim stack size to 100 frames. (Was 300 before.)
  • Keep the stack sized trimmed when moving on to the Strings strategy. (Previously reverted to the full original stack.)
  • Allow worst case string trimming to 128 chars. (Was 256 worst case.)

@waltjones waltjones merged commit fa7a680 into master Dec 17, 2019
@waltjones waltjones deleted the wj-better-locals-data branch June 27, 2023 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant