envoy-gloo icon indicating copy to clipboard operation
envoy-gloo copied to clipboard

upstream transformation_filter

Open EItanya opened this issue 1 year ago • 1 comments

This PR makes two major changes to the transformation filter:

  1. 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. The WaitFilter hooks 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.
  2. Added a word_count template function to the inja_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.

EItanya avatar May 23 '24 12:05 EItanya

@nfuden I split the word_count and other functions into a separate PR for simplicity. #341

EItanya avatar May 24 '24 14:05 EItanya

Issues linked to changelog: https://github.com/solo-io/envoy-gloo/issues/342

solo-changelog-bot[bot] avatar May 31 '24 11:05 solo-changelog-bot[bot]