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

Optimize body filters #493

Closed
4 tasks
whiskeysierra opened this issue Apr 25, 2019 · 2 comments · Fixed by #713
Closed
4 tasks

Optimize body filters #493

whiskeysierra opened this issue Apr 25, 2019 · 2 comments · Fixed by #713
Milestone

Comments

@whiskeysierra
Copy link
Collaborator

Detailed Description

Registering multiple body filters of the same type, e.g. replaceJsonStringProperty works but is inefficient because they run sequentially. Optimizing those filters by merging them into one would be useful.

Context

Improve performance by reducing raw body processing to the bare minimum.

Possible Implementation

  • New interface MergeableBodyFilter (extends BodyFilter)
  • Make replaceJsonStringProperty a proper class, implementing MergeableBodyFilter
  • Check for instanceof ReplaceJsonStringProperty and create a new instance using properties from this and the other filter
  • Optimize mergeable body filters within BodyFilter.merge(..)
@whiskeysierra whiskeysierra pinned this issue Apr 26, 2019
@skjolber
Copy link
Contributor

skjolber commented May 19, 2019

So why the String part of replaceJsonStringProperty, surely replacing other property types or even array and objects would be desirable? We're using a filter just like that (which parses and writes) now, not just for removing values we don't want to log, but also to reduce the size of the log statement (there is a max size).

@whiskeysierra
Copy link
Collaborator Author

So why the String part of replaceJsonStringProperty, surely replacing other property types or even array and objects would be desirable?

Replacing whole structures requires to properly parse the string. String properties can be detected and replaced quite easily and quickly using regular expressions. It's a simple trade-off between power and speed. Replacing string properties was solving the majority of cases without introducing a full second parsing of the body.

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 a pull request may close this issue.

2 participants