SylviaBABY commented on code in PR #6891: URL: https://github.com/apache/apisix/pull/6891#discussion_r854748011
########## docs/zh/latest/plugins/fault-injection.md: ########## @@ -23,23 +29,33 @@ title: fault-injection ## 描述 -故障注入插件,该插件可以和其他插件一起使用,并且会在其他插件前被执行,配置 `abort` 参数将直接返回给客户端指定的响应码并且终止其他插件的执行,配置 `delay` 参数将延迟某个请求,并且还会执行配置的其他插件。 +`fault-injection` 插件,该插件可以和其他插件一起使用,并且会在其他插件前被执行。 + +`abort` 属性将直接返回给客户端指定的响应码并且终止其他插件的执行。 + +`delay` 属性将延迟某个请求,并且还会执行配置的其他插件。 ## 属性 -| 名称 | 类型 | 必选项 | 默认值 | 有效值 | 描述 | -| ----------------- | ------- | ------ | ------ | ---------- | -------------------------- | -| abort.http_status | integer | 必需 | | [200, ...] | 返回给客户端的 http 状态码 | -| abort.body | string | 可选 | | | 返回给客户端的响应数据。支持使用 Nginx 变量,如 `client addr: $remote_addr\n`| -| abort.percentage | integer | 可选 | | [0, 100] | 将被中断的请求占比 | -| abort.vars | array[] | 可选 | | | 执行故障注入的规则,当规则匹配通过后才会执行故障注。`vars` 是一个表达式的列表,来自 [lua-resty-expr](https://github.com/api7/lua-resty-expr#operator-list)。 | -| delay.duration | number | 必需 | | | 延迟时间,可以指定小数 | -| delay.percentage | integer | 可选 | | [0, 100] | 将被延迟的请求占比 | -| delay.vars | array[] | 可选 | | | 执行请求延迟的规则,当规则匹配通过后才会延迟请求。`vars` 是一个表达式列表,来自 [lua-resty-expr](https://github.com/api7/lua-resty-expr#operator-list)。 | +| 名称 | 类型 | 必选项 | 有效值 | 描述 | +| ----------------- | ------- | ---- | ---------- | -------------------------- | +| abort.http_status | integer | 是 | [200, ...] | 返回给客户端的 HTTP 状态码 | +| abort.body | string | 否 | | 返回给客户端的响应数据。支持使用 NGINX 变量,如 `client addr: $remote_addr\n`| +| abort.percentage | integer | 否 | [0, 100] | 将被中断的请求占比 | +| abort.vars | array[] | 否 | | 执行故障注入的规则,当规则匹配通过后才会执行故障注。`vars` 是一个表达式的列表,来自 [lua-resty-expr](https://github.com/api7/lua-resty-expr#operator-list)。 | +| delay.duration | number | 是 | | 延迟时间,可以指定小数 | +| delay.percentage | integer | 否 | [0, 100] | 将被延迟的请求占比 | +| delay.vars | array[] | 否 | | 执行请求延迟的规则,当规则匹配通过后才会延迟请求。`vars` 是一个表达式列表,来自 [lua-resty-expr](https://github.com/api7/lua-resty-expr#operator-list)。 | + +:::info IMPORTANT + +`abort` 和 `delay` 属性至少要配置一个。 Review Comment: ```suggestion - `abort` 属性将直接返回给客户端指定的响应码并且终止其他插件的执行。 - `delay` 属性将延迟某个请求,并且还会执行配置的其他插件。 - `abort` 和 `delay` 属性至少要配置一个。 ``` -- 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]
