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

Refactoring the processing of a service grpc response #95

Merged
merged 2 commits into from
Oct 7, 2024

Conversation

didierofrivia
Copy link
Member

  • Treated in their respective Service modules
  • Calling directly hostcalls instead of relying on Filter instance

@didierofrivia didierofrivia self-assigned this Oct 3, 2024
@didierofrivia didierofrivia force-pushed the refactoring-grpc-response branch from 56794f9 to 65f2b60 Compare October 3, 2024 14:52
@didierofrivia didierofrivia changed the title Refactoring the process of grpc service response Refactoring the processing of a grpc service response Oct 3, 2024
@didierofrivia didierofrivia changed the title Refactoring the processing of a grpc service response Refactoring the processing of a service grpc response Oct 3, 2024
GrpcService::process_grpc_response(
operation,
resp_size,
&mut self.response_headers_to_add,
Copy link
Member

Choose a reason for hiding this comment

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

I realise this is how this was before, but I'm now wondering why we're doing it like this - why is the response headers stored locally in the filter instead of using the envoy hostcalls like in auth? Should auth do it this way, or should ratelimit do the same as auth?

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes total sense to have them both the same. I'll review the option of matching external auth 👍🏼

Copy link
Member

@adam-cattermole adam-cattermole Nov 13, 2024

Choose a reason for hiding this comment

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

Just for clarification now that I've learned - the reason we do it like this is to ensure the response headers are added at the correct phase - just before we return a response to the downstream client. In the case here we're adding them before the request is made to the upstream. I've fixed this in #144

Copy link
Member

@adam-cattermole adam-cattermole left a comment

Choose a reason for hiding this comment

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

Only one q, the rest looks good. Mainly popped out at me because the call signature in process_grpc_response is different in auth and ratelimit when they both have the same function regarding response headers.

* Treated in their respective Service modules
* Calling directly `hostcalls` instead of relying on Filter instance

Signed-off-by: dd di cesare <[email protected]>
* Instead of passing the Filter instance of `response_headers_to_add`
* Matching the Auth Service

Signed-off-by: dd di cesare <[email protected]>
Copy link
Member

@adam-cattermole adam-cattermole left a comment

Choose a reason for hiding this comment

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

Nice job, lgtm!

I will quickly add just so we have it documented - perhaps we in the future want to refactor this again so that we can pass information between the extensions without performing hostcalls; just for the worst case where we write the response headers but then end up denying the request at a future extension anyway.

@didierofrivia didierofrivia merged commit f4c37ce into main Oct 7, 2024
8 checks passed
@didierofrivia didierofrivia deleted the refactoring-grpc-response branch October 7, 2024 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants