envoy-gloo
envoy-gloo copied to clipboard
upstream transformation_filter
This PR makes two major changes to the transformation filter:
- It allows the transformation filter to be run as an
upstream_http_filter. This means it can be set either in the cluster or the router filter.- As a part of this work I also needed to add an additional upstream_http_filter which I have name the
WaitFilter. This is an unfortunate side effect of how upstream selection works in relation to transformations which require modifying body and headers. Upstream selection in envoy happens async and then fires off a callback when it's done. TheWaitFilterhooks into that callback, stopping all iteration until it's called, and then resumes filter iteration. This filter MUST be added when modifying the body as a part of an upstream http_filter. If we decide to also include lambda functionality this may also be necessary.
- As a part of this work I also needed to add an additional upstream_http_filter which I have name the
- Added a
word_counttemplate function to theinja_transformer. The current use-case is best-guess tokenizing for AI Gateway use cases. The function definitely still has edge cases, but it handles nested JSON and covers basic English use-cases.
@nfuden I split the word_count and other functions into a separate PR for simplicity. #341
Issues linked to changelog: https://github.com/solo-io/envoy-gloo/issues/342