Skip to content

lua: filter context implementation #39263

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

wbpcode
Copy link
Member

@wbpcode wbpcode commented Apr 29, 2025

Commit Message: lua: filter context implementation
Additional Description:
Risk Level: low.
Testing: unit.
Docs Changes: added.
Release Notes: added.
Platform Specific Features: n/a.

Signed-off-by: wangbaiping(wbpcode) <wbphub@gmail.com>
Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @adisuissa
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #39263 was opened by wbpcode.

see: more, trace.

wbpcode added 3 commits April 29, 2025 15:41
Signed-off-by: wangbaiping(wbpcode) <wbphub@gmail.com>
Signed-off-by: wangbaiping(wbpcode) <wbphub@gmail.com>
Signed-off-by: wangbaiping(wbpcode) <wbphub@gmail.com>
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.

/lgtm api
Overall the code LGTM, but my knowledge of the lua filter is limited.
I'm going to approve, and let you decide whether it should receive another set of eyes.

}

const ProtobufWkt::Struct& filterContext() const {
return per_route_config_ == nullptr ? ProtobufWkt::Struct::default_instance()
Copy link
Contributor

Choose a reason for hiding this comment

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

perf-nit: seems a bit wasteful to always pass the default_instance in cases where the filter_context field wasn't set.
I'm not sure what are the performance implications, and that's why I'd leave it up to the code-owners (you) to decide.

Copy link
Member Author

Choose a reason for hiding this comment

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

The ProtobufWkt::Struct::default_instance() will return a const refrerence to a global variable. Basically, it won't bring any performance penality.

Copy link
Member Author

Choose a reason for hiding this comment

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

I will defer this to @ggreenway. @ggreenway is familiar to Lua code.

Copy link
Contributor

Choose a reason for hiding this comment

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

The ProtobufWkt::Struct::default_instance() will return a const refrerence to a global variable. Basically, it won't bring any performance penality.

I was refering to the call to luaFilterContext that I don't understand when it will to be invoked.
If you think that's ok, or that the overhead will be minimal, SGTM.

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.

3 participants