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

question: should the lua filter log whether or not responses will be hooked when missing function envoy_on_...? #37397

Closed
cetanu opened this issue Nov 28, 2024 · 5 comments
Labels
area/lua enhancement Feature requests. Not bugs or questions. stale stalebot believes this issue/PR has not been touched recently

Comments

@cetanu
Copy link
Contributor

cetanu commented Nov 28, 2024

I get these log messages showing up

"envoy_on_request() function not found. Lua filter will not hook requests."

and I wanted to bring forward the question as to whether they should be an INFO level log message, or debug?
They seem somewhat noisy - my thinking is that most people who configure a lua filter are not surprised if they aren't hooking into either the request or response, in the cases where they only want to handle one. So what is the purpose behind this message?

Should it perhaps be a warning if BOTH functions are missing, but otherwise debug?

Secondarily, if someone was to add function envoy_on_response(_) end into all their lua filters in order to suppress this log message, does that incur any overheads when envoy is running? Does it then cause the lua filter to hook into the request/response, do nothing, and then continue?

Let me know your thoughts.

https://github.com/envoyproxy/envoy/blob/main/source/extensions/filters/http/lua/lua_filter.cc#L223-L230

@cetanu cetanu added the triage Issue requires triage label Nov 28, 2024
@ggreenway
Copy link
Contributor

I think the idea behind the log message is for cases where you didn't realize you didn't hook the function, for example if you had a typo in the name of the function.

Possibly a better fix might be to provide configuration for whether the two functions are defined or not, and throw an error if it is supposed to be present and is not. But it would probably be reasonable to change those messages to debug-level unless they're both missing, as you suggest.

@ggreenway ggreenway added area/lua enhancement Feature requests. Not bugs or questions. and removed triage Issue requires triage labels Dec 2, 2024
@cetanu
Copy link
Contributor Author

cetanu commented Dec 8, 2024

I agree with the better fix 👍🏼 putting this in configuration with sane defaults make sense.

Does this structure and naming seem sensible:

message Lua {
  LogMissingHooks log_missing_hooks = 0;

  enum LogMissingHooks {
    LOG_NONE = 0;
    LOG_MISSING_REQUEST_HOOK = 1;
    LOG_MISSING_RESPONSE_HOOK = 2;
    LOG_BOTH_HOOKS = 3;
    LOG_ANY_MISSING = 4;
  }
}

If so, I will try to find some time to open a PR for this

@ggreenway
Copy link
Contributor

I think just having two boolean settings would be simpler.

But this is probably overkill for this. I'd just change it to a debug-level message for both of these, unless neither is defined and then log them at info/warn level.

Copy link

github-actions bot commented Jan 8, 2025

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale stalebot believes this issue/PR has not been touched recently label Jan 8, 2025
Copy link

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/lua enhancement Feature requests. Not bugs or questions. stale stalebot believes this issue/PR has not been touched recently
Projects
None yet
Development

No branches or pull requests

2 participants