fix: Set upstream and upstream_latency vars in ext-plugin-post-resp for logging#13018
fix: Set upstream and upstream_latency vars in ext-plugin-post-resp for logging#13018MariaLapovska wants to merge 1 commit intoapache:masterfrom
Conversation
|
would you be able to add test case that cover your fix? |
|
@janiussyafiq I'm not sure which test case I can add for this, since it simply adds two vars to nginx context. Would you be able to help me out? |
|
@MariaLapovska you should add tests that verify that the variables you newly introduced are actually taking effect and hold correct values. |
|
Hi @MariaLapovska, following up on the previous review comments. Please let us know if you have any updates. Thank you. |
moonming
left a comment
There was a problem hiding this comment.
Hi @MariaLapovska, thank you for fixing the missing upstream variables in ext-plugin-post-resp!
Setting upstream and upstream_latency vars in the ext-plugin-post-resp phase for logging is a valid fix — these variables should be available for downstream loggers to capture.
One requirement: This PR needs test cases to verify:
- The
upstreamvariable is populated correctly after ext-plugin-post-resp runs - The
upstream_latencyvariable reflects the actual upstream response time - Logger plugins (e.g., http-logger) correctly capture these values when used alongside ext-plugin-post-resp
The fix is only 5 lines, so adding focused test cases should be straightforward. Looking forward to the update!
Description
When using ext-plugin-post-resp and http-logger, some values are missing from the logs, specifically the ones related to upstream - upstream and upstream_latency.
This is happening because upstream_response_time and upstream_addr nginx vars are unavailable, so when log-util.lua is trying to inject them into logs, no value is present.
This PR adds these two vars to ext-plugin-post-resp, they are now set explicitly after the call to upstream.
Which issue(s) this PR fixes:
Fixes #13016
Checklist