-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: wangbaiping(wbpcode) <wbphub@gmail.com>
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
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.
/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() |
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.
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.
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.
The ProtobufWkt::Struct::default_instance() will return a const refrerence to a global variable. Basically, it won't bring any performance penality.
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.
I will defer this to @ggreenway. @ggreenway is familiar to Lua code.
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.
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.
Commit Message: lua: filter context implementation
Additional Description:
Risk Level: low.
Testing: unit.
Docs Changes: added.
Release Notes: added.
Platform Specific Features: n/a.