-
Notifications
You must be signed in to change notification settings - Fork 5.2k
dynamic_module: add new streamable HTTP callout support #42225
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
base: main
Are you sure you want to change the base?
Conversation
b498e2d to
f9ea7e9
Compare
wbpcode
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for picking this up. One comment to the ABI to start the review. :)
1f1f7d3 to
bc82115
Compare
Signed-off-by: Rohit Agrawal <[email protected]>
9126681 to
47e213a
Compare
Signed-off-by: Rohit Agrawal <[email protected]>
47e213a to
a81c6f8
Compare
|
CC @envoyproxy/coverage-shephards: FYI only for changes made to |
mathetake
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so cool, thank you so much for taking this up! I am trying to think about the way to remove the necessity for "unsafe" on these pointer passing methods but yeah i think there's no way around it seems..
| // We need to linearize the buffer because the module expects a contiguous buffer. | ||
| auto linear = data.linearize(length); | ||
| filter_->config_->on_http_filter_http_stream_data_( | ||
| filter_->thisAsVoidPtr(), filter_->in_module_filter_, this_as_void_ptr_, | ||
| const_cast<char*>(reinterpret_cast<const char*>(linear)), length, end_stream); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm i hope we won't need to linearize the buffer. is it possible to map Buffer::Instance to the &[EnvoyBuffer] on Rust directly like the other body accessor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we can a vector slice (instead of copying the entire buffers via linearization) here and map it to &'s [EnvoyBuffer] that is only alive until the callback exits
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can give it a try
| /// | ||
| /// After starting the stream, use the returned stream_handle to send data/trailers or reset. | ||
| /// Stream events will be delivered to the [`HttpFilter::on_http_stream_*`] methods. | ||
| fn start_http_stream<'a>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a documentation comment that when the HTTP stream ends, any of the callback below will never be called again from that point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will add :)
Signed-off-by: Rohit Agrawal <[email protected]>
Signed-off-by: Rohit Agrawal <[email protected]>
Signed-off-by: Rohit Agrawal <[email protected]>
Signed-off-by: Rohit Agrawal <[email protected]>
Description
The Async streamable HTTP client is supported by Envoy since long time. Using it, we can create multiple different HTTP streams to different backends at the same time and distribute requests between these backends.
This PR exposes this feature to dynamic modules. It could be used for developing MCP related dynamic modules.
Fix #42045
Commit Message: dynamic_module: add new streamable HTTP callout support
Additional Description: Add support for the Async streamable HTTP client in Dynamic Modules.
Risk Level: Low
Testing: Added Unit + Integration Tests
Docs Changes: Added
Release Notes: Added