Skip to content

ext_proc: convert ext_proc filter into dual filter#33273

Merged
yanavlasov merged 11 commits intoenvoyproxy:mainfrom
yanjunxiang-google:ext_proc_dual_filter
Apr 12, 2024
Merged

ext_proc: convert ext_proc filter into dual filter#33273
yanavlasov merged 11 commits intoenvoyproxy:mainfrom
yanjunxiang-google:ext_proc_dual_filter

Conversation

@yanjunxiang-google
Copy link
Copy Markdown
Contributor

This PR converts ext_proc filter into dual filter so it can be created in the upstream filter chain.

Commit Message:
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>
Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>
Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>
Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>
Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>
Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>
@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @wbpcode
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #33273 was opened by yanjunxiang-google.

see: more, trace.

@yanjunxiang-google yanjunxiang-google marked this pull request as draft April 2, 2024 20:36
Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>
Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>
Comment thread source/extensions/filters/http/common/factory_base.h
@yanjunxiang-google yanjunxiang-google marked this pull request as ready for review April 8, 2024 22:17
@yanjunxiang-google
Copy link
Copy Markdown
Contributor Author

/assign @tyxia @htuch @yanavlasov

Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>
@yanjunxiang-google
Copy link
Copy Markdown
Contributor Author

yanjunxiang-google commented Apr 9, 2024

The CI coverage complaints in factory_base.h is addressed by tests added in #33013. Will do a upstream merge after that PR is committed.

@yanjunxiang-google
Copy link
Copy Markdown
Contributor Author

/wait

Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm api

Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>
Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>
@yanjunxiang-google
Copy link
Copy Markdown
Contributor Author

Kind ping!

@htuch
Copy link
Copy Markdown
Member

htuch commented Apr 11, 2024

@yanavlasov @tyxia

@yanjunxiang-google
Copy link
Copy Markdown
Contributor Author

King Ping!

@yanavlasov yanavlasov merged commit 34bb97c into envoyproxy:main Apr 12, 2024
Copy link
Copy Markdown
Member

@tyxia tyxia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! (sorry for late review)

Could you also add a simple test upstream callout filter in next PR? It is good to have test for upstream match_delegate and composite + upstream callout filter in OSS in case this feature is accidentally broken by someone.

Comment thread test/extensions/filters/http/ext_proc/ext_proc_integration_test.cc
Comment thread source/extensions/filters/http/ext_proc/processor_state.cc
Comment thread source/extensions/filters/http/ext_proc/config.cc
@yanjunxiang-google
Copy link
Copy Markdown
Contributor Author

For the match_delegate + composite + ext_proc, this involves extension test refer another extension. I would like to avoid doing this in OSS.

@tyxia
Copy link
Copy Markdown
Member

tyxia commented Apr 12, 2024

For the match_delegate + composite + ext_proc, this involves extension test refer another extension. I would like to avoid doing this in OSS.

What I actually suggested is match_delegate + composite + test callout filter, which exactly try to avoid cross-reference

@yanjunxiang-google
Copy link
Copy Markdown
Contributor Author

Got it! Will add a test like that in next PR.

cainelli pushed a commit to cainelli/envoy that referenced this pull request Apr 18, 2024
---------

Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>
Signed-off-by: Fernando Cainelli <fernando.cainelli-external@getyourguide.com>
alyssawilk pushed a commit to alyssawilk/envoy that referenced this pull request Apr 29, 2024
---------

Signed-off-by: Yanjun Xiang <yanjunxiang@google.com>
Comment on lines +1050 to +1052
if (config_->isUpstream()) {
stats_.send_immediate_resp_upstream_ignored_.inc();
ENVOY_LOG(debug, "Ignoring send immediate response when ext_proc filter is in upstream");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, sorry for commenting on the old issue but what was the rationale for this? I actually hit this case, and would like to understand if this is the fundamental limitation of the envoy core level or it's just an extension side implementation matter. @yanjunxiang-google

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and remove these lines, and tried it out for our use case. It works totally fine. Can I go ahead and remove this restriction, otherwise upstream filter extproc cannot fail literally as it will result in a timeout on the client side as well as this is not a documented behavior as far as i understand. cc @yanavlasov

envoyproxy/ai-gateway#840

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @yanjunxiang-google @yanavlasov -- sorry to bump here but can you take a look at my comments above?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that's an implementation choice . The goal for configuration ext_proc in upstream back then is just for ext_proc server logging purpose, and not planned for receiving immediate response. If you need it to be supported, please feel free to raise a PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, thank you for clarifying!!! will do soon

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not the decision choice. local reply in upstream filter chain needs extra cautions and test/documentation
source/docs/upstream_filters.md

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, local reply is not seen by upstream http filter

// Local replies will not be seen by upstream HTTP filters.

tyxia pushed a commit that referenced this pull request Oct 7, 2025
Commit Message: ext_proc: allow immediate response from upstream filter

Additional Description:
This is from the discussion here:
#33273 (comment)
Previously, sending local replies from an upstream ext_proc filter was
prohibited just because of the implementation choice. This prevented
users from returning errors from there, which results in clients
indefinitely waiting for the response until timeout without any
feedback. In short, ext_proc was previously unable to fail.

Closes envoyproxy/ai-gateway#840

Risk Level: low (previously considered invalid code paths)
Testing: done
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: n/a

---------

Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants