nic-6443 opened a new pull request, #13710:
URL: https://github.com/apache/apisix/pull/13710

   ### Description
   
   Currently the `Apisix-Plugins` debug header is built from a hash set filled 
at plugin *filtering* time, so the reported list is unordered (`pairs()` 
iteration) and carries no phase information — it tells you which plugins 
matched the route, not what actually ran, and the order doesn't match the 
execution order at all.
   
   This PR records each executed plugin phase function as `name#phase` at 
execution time in `run_plugin` (and `lua_response_filter`), so the header now 
reports the entries strictly in the runtime execution order, e.g.:
   
   ```
   Apisix-Plugins: limit-conn#access, limit-count#access, 
response-rewrite#header_filter
   ```
   
   A phase function that runs more than once (e.g. `body_filter` per response 
chunk, or re-runs on balancer retries) is recorded only once, at its first 
execution. `rewrite_in_consumer` executions are reported as `rewrite`, since 
that's the actual function being run.
   
   Restricted by the HTTP protocol, phase functions executed after the response 
header is generated (`body_filter`, `log`, ...) can not be included in the 
response header — they are logged as a warn log instead (`Apisix-Plugins: 
http-logger#log`). This limitation was not documented before; the doc now 
covers it. I also removed the doc claim that stream subsystem plugins are 
logged this way: the stream Lua VM never loads `debug.yaml` 
(`stream_init_worker` doesn't call `debug.init_worker()`), so that path has 
always been dead — making basic debug mode actually work for stream can be a 
separate discussion.
   
   Since the order is now deterministic, the tests that had to parse the header 
into a hash to tolerate the random order can just assert the literal header 
value.
   
   #### Which issue(s) this PR fixes:
   
   None
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [x] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible (If not, 
please discuss on the [APISIX mailing 
list](https://github.com/apache/apisix/tree/master#community) first)
   


-- 
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]

Reply via email to