You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/01/25 07:04:22 UTC
[GitHub] [apisix] Firstsawyou commented on a change in pull request #3363: feat(fault-injection): support conditional fault injection using nginx variables
Firstsawyou commented on a change in pull request #3363:
URL: https://github.com/apache/apisix/pull/3363#discussion_r563498525
##########
File path: apisix/plugins/fault-injection.lua
##########
@@ -15,13 +15,66 @@
-- limitations under the License.
--
local core = require("apisix.core")
+local expr = require("resty.expr.v1")
local sleep = core.sleep
local random = math.random
+local ipairs = ipairs
local plugin_name = "fault-injection"
+local vars_schema = {
Review comment:
updated.
##########
File path: apisix/plugins/fault-injection.lua
##########
@@ -64,6 +119,25 @@ local function sample_hit(percentage)
end
+local function vars_match(vars, ctx)
+ local match_result
+ for _, var in ipairs(vars) do
+ local expr, err = expr.new(var)
+ if err then
+ core.log.error("vars expression does not match: ", err)
Review comment:
updated.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org