Skip to content

Conversation

@agrawroh
Copy link
Member

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

@repokitteh-read-only
Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #42225 was opened by agrawroh.

see: more, trace.

@agrawroh agrawroh force-pushed the feat-dm-extnd branch 7 times, most recently from b498e2d to f9ea7e9 Compare November 24, 2025 22:27
Copy link
Member

@wbpcode wbpcode left a 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. :)

@agrawroh agrawroh force-pushed the feat-dm-extnd branch 10 times, most recently from 1f1f7d3 to bc82115 Compare November 25, 2025 18:55
@agrawroh agrawroh force-pushed the feat-dm-extnd branch 2 times, most recently from 9126681 to 47e213a Compare November 25, 2025 20:44
Signed-off-by: Rohit Agrawal <[email protected]>
@repokitteh-read-only
Copy link

CC @envoyproxy/coverage-shephards: FYI only for changes made to (test/coverage.yaml).
envoyproxy/coverage-shephards assignee is @RyanTheOptimist

🐱

Caused by: #42225 was synchronize by agrawroh.

see: more, trace.

@agrawroh agrawroh marked this pull request as ready for review November 25, 2025 22:24
@agrawroh agrawroh requested a review from mathetake as a code owner November 25, 2025 22:24
Copy link
Member

@mathetake mathetake left a 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..

Comment on lines 391 to 395
// 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);
Copy link
Member

@mathetake mathetake Nov 26, 2025

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?

Copy link
Member

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

Copy link
Member Author

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>(
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Will add :)

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 this pull request may close these issues.

dynamic module: new streamable HTTP callout support

4 participants