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
Adding streaming response to AdminClusters endpoint #33879
base: main
Are you sure you want to change the base?
Conversation
9214bf8
to
0e4cc40
Compare
Seems that this PR includes many file changes. As it doesn't have reviews yet, can you please rebase it? |
Apologies, I misread the PR contents. |
|
There are some aspects to this PR that I believe should be known to folks reviewing:
|
You can do addFragments in this PR or a follow-up; if it adds risk it's fine to do a follow-up I think you should add a new benchmark, in the style of test/server/admin/stats_handler_speed_test.cc. I think there are probably some unit & integration tests already. A good way to find them is to inject garbage into your output, run all the tests and see which ones fail :) However, you can also look at test/integration/integratin_admin_test.cc and the tests in test/server/admin/... |
Oh, and you can add the new benchmark in a separate PR so we can see the before/after. |
@jmarantz I'll create a separate Issue/PR to create a benchmark for the AdminClusters handler. We can get get that merged first. I can rebase those changes into this branch and make sure that the performance is improved. |
f5e12db
to
c2c81e9
Compare
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.
flushing comments for now.
Addressed your comments. Thanks. |
b801d24
to
c65b1cc
Compare
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.
looking great!
Flushing some more comments. Will continue to review in parallel.
void render(std::reference_wrapper<const Upstream::Cluster> cluster, Buffer::Instance& response); | ||
void drainBufferIntoResponse(Buffer::Instance& response); | ||
void finalize(Buffer::Instance& response); | ||
void addAddress(Json::Streamer::Map* raw_host_ptr, const Upstream::HostSharedPtr& host, |
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.
why are we passing by pointer here? In Envoy, non-const refs are preferred unless there's some special reason they should be pointers, in which case there should be comments.
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.
So, the constructors for json maps and arrays in Envoy::Json::Streamer
create unique pointers by the name Envoy::Json::Streamer::MapPtr
and Envoy::Json::Streamer::ArrayPtr
. Within the code, sometimes I need to pass the map or array to a private helper function to do extra work without terminating the array or map (termination happens during deconstruction). By passing the raw pointer, I can loan the pointer to the map or array to the helper function to do work without it owning it and prematurely terminating the the array or map with closing tokens.
I am open to recommendations; this just seemed like the most straight forward way to achieve this. If you think this is sensible I am happy to add comments to each of these private member functions that take the raw pointer.
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
…tatement Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
…ig when C++20 is supported Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
…ery param parsing fails Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
05682e1
to
cc840be
Compare
…n the request classes Signed-off-by: Demitri Swan <demitriswan@google.com>
Signed-off-by: Demitri Swan <demitriswan@google.com>
Commit Message: Adding streaming response to AdminClusters endpoint
Additional Description: Leveraging Envoy::Server::Request to implement a streaming response for AdminClusters
Risk Level: medium
Testing: unit / integration / manual
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A
[Optional Runtime guard:]
[Optional Fixes #Issue]: #33879
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]