Skip to content
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

Invoke ORCA Load Report callbacks from Router::Filter. #35728

Merged
merged 3 commits into from
Aug 27, 2024

Conversation

efimki
Copy link
Contributor

@efimki efimki commented Aug 16, 2024

Commit Message:
Invoke ORCA Load Report callbacks from Router::Filter.

  • Add LoadBalancerContext::setOrcaLoadReportCb(OrcaLoadReportCb callback) method.
  • Allow LoadBalancer to set the callback to be invoked when ORCA load report is received.

Risk Level: Low
Release Notes: N/A
Platform Specific Features: N/A
#34777

- Add `LoadBalancerContext::setOrcaLoadReportCb(OrcaLoadReportCb callback)` method.

Signed-off-by: Misha Efimov <[email protected]>
@adisuissa adisuissa self-assigned this Aug 16, 2024
@efimki
Copy link
Contributor Author

efimki commented Aug 16, 2024

/assign @adisuissa

Copy link
Contributor

@adisuissa adisuissa left a comment

Choose a reason for hiding this comment

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

Overall LGTM!
Please add tests to increase coverage of the maybeProcessOrcaLoadReport() method (see https://storage.googleapis.com/envoy-pr/caeacc6/coverage/source/common/router/router.cc.gcov.html).

/wait

@@ -2118,7 +2118,7 @@ void Filter::maybeProcessOrcaLoadReport(const Envoy::Http::HeaderMap& headers_or
auto host = upstream_request.upstreamHost();
const bool need_to_send_load_report =
(host != nullptr) && cluster_->lrsReportMetricNames().has_value();
if (!need_to_send_load_report) {
if (!need_to_send_load_report && !orca_load_report_cb_) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: please update the comment above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hrm, I think it is already correct as it says "or invoke the ORCA callbacks.", what am I missing?

source/common/router/router.cc Outdated Show resolved Hide resolved
@wbpcode
Copy link
Member

wbpcode commented Aug 21, 2024

I am back. Will take a look at this tomorrow. :)

@wbpcode wbpcode self-assigned this Aug 22, 2024
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.

LGTM overall with some minor comments. Seems that we can land this very soon. hah.

envoy/upstream/load_balancer.h Outdated Show resolved Hide resolved
@efimki
Copy link
Contributor Author

efimki commented Aug 26, 2024

Thank you for your feedback! I was OOO last week and will address your comments shortly.

@efimki efimki requested a review from wbpcode August 27, 2024 01:42
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.

LGTM, Thanks. I think it would be pretty quick to see our new LB, haha.

@wbpcode
Copy link
Member

wbpcode commented Aug 27, 2024

/retest

@efimki
Copy link
Contributor Author

efimki commented Aug 27, 2024

LGTM, Thanks. I think it would be pretty quick to see our new LB, haha.

Thank you for quick reply and approval!
I have the LB PR next, I just need to update it with the new callbacks interface.

Copy link
Member

@botengyao botengyao left a comment

Choose a reason for hiding this comment

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

LGTM, module a log usage.

/assign @yanavlasov

if (orca_load_report_callbacks_.has_value()) {
const absl::Status status = orca_load_report_callbacks_->onOrcaLoadReport(*orca_load_report);
if (!status.ok()) {
ENVOY_LOG_MISC(error, "Failed to invoke OrcaLoadReportCallbacks: {}", status.message());
Copy link
Member

Choose a reason for hiding this comment

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

consider using ENVOY_LOG/ENVOY_STREAM_LOG rather than the misc one.

Copy link
Member

Choose a reason for hiding this comment

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

@efimki Merge it due to tight schedule but please do address this comment above in a follow-up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, @tyxia! My apologies as I've totally missed this comment. I'll address that in a follow-up.

Copy link
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.

LGTM, Thanks

@tyxia tyxia merged commit 45e0325 into envoyproxy:main Aug 27, 2024
48 checks passed
@efimki efimki deleted the orca_callbacks branch November 12, 2024 15:11
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.

6 participants