Copilot commented on code in PR #12777:
URL: https://github.com/apache/apisix/pull/12777#discussion_r2917218977
##########
apisix/debug.lua:
##########
@@ -192,6 +196,13 @@ local function apply_new_fun(module, fun_name, file_path,
hook_conf)
end
end
+ if hook_conf.is_print_traceback then
+ if enable_by_hook or enable_by_header_filter then
+ log[log_level]("call require(\"", file_path, "\").", fun_name,
+ "() call stack:", debug.traceback())
Review Comment:
The log output currently concatenates the prefix "() call stack:" directly
with `debug.traceback()`'s default leading text ("stack traceback:"), producing
"call stack:stack traceback:" with no separator and a redundant label. Consider
using `debug.traceback(<message>, <level>)` to embed the message and add a
newline/space separator, and set the level to skip the hook wrapper frames
(e.g., start traceback at the original caller rather than `mt.__call`).
```suggestion
local msg = "call require(\"" .. file_path .. "\")." ..
fun_name .. "() call stack:"
local tb = debug.traceback(msg, 3)
log[log_level](tb)
```
##########
apisix/debug.lua:
##########
@@ -77,6 +78,9 @@ local config_schema = {
is_print_return_value = {
type = "boolean",
},
+ is_print_traceback = {
+ type = "boolean",
+ },
}
Review Comment:
A new debug.yaml option `hook_conf.is_print_traceback` is introduced in the
schema, but the debug-mode documentation tables/examples still only describe
`is_print_input_args` and `is_print_return_value`. Please update the docs (both
EN/ZH) and the sample configuration to include this new key so users can
discover and configure it correctly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]