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 2022/08/13 11:46:44 UTC

[GitHub] [apisix] lunarwhite opened a new pull request, #7666: docs(plugin): refactor api-breaker.md

lunarwhite opened a new pull request, #7666:
URL: https://github.com/apache/apisix/pull/7666

   ### Description
   
   update documents under `docs/zh/latest/plugins/` along with `docs/en/latest/plugins/`
   
   ### 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
   - [ ] 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)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] hf400159 commented on a diff in pull request #7666: docs(plugin): refactor api-breaker.md

Posted by GitBox <gi...@apache.org>.
hf400159 commented on code in PR #7666:
URL: https://github.com/apache/apisix/pull/7666#discussion_r945450918


##########
docs/zh/latest/plugins/api-breaker.md:
##########
@@ -85,24 +88,33 @@ curl "http://127.0.0.1:9080/apisix/admin/routes/1" -H 'X-API-KEY: edd1c9f034335f
 
 ## 测试插件
 
-使用上游的配置,在一定时间内如果你的上流服务返回 500 达到 3 次。客户端将会收到 502(break_response_code)应答。
+按上述配置启用插件后,使用 `curl` 命令请求该路由:
 
 ```shell
 $ curl -i "http://127.0.0.1:9080/hello"

Review Comment:
   ```suggestion
   curl -i "http://127.0.0.1:9080/hello"
   ```



##########
docs/zh/latest/plugins/api-breaker.md:
##########
@@ -23,42 +28,40 @@ title: api-breaker
 
 ## 描述
 
-该插件实现 API 熔断功能,帮助我们保护上游业务服务。
+`api-breaker` 插件实现了 API 熔断功能,从而帮助我们保护上游业务服务。
 
-> 关于熔断超时逻辑
+:::note 注意
 
-由代码逻辑自动按**触发不健康状态**的次数递增运算:
+关于熔断超时逻辑,由代码逻辑自动按**触发不健康状态**的次数递增运算:
 
-每当上游服务返回 `unhealthy.http_statuses` 配置中的状态码(比如:500),达到 `unhealthy.failures` 次时 (比如:3 次),认为上游服务处于不健康状态。
+每当上游服务返回 `unhealthy.http_statuses` 配置中的状态码(比如:`500`),并达到 `unhealthy.failures` 次时,则认为上游服务处于不健康状态。
 
-第一次触发不健康状态,**熔断 2 秒**。
+第一次触发不健康状态,熔断 2 秒,然后重新开始转发请求到上游服务,如果继续返回 `unhealthy.http_statuses` 状态码,记数再次达到 `unhealthy.failures` 次时,熔断 4 秒。依次类推,2,4,8,16,最大到 `max_breaker_sec`。
 
-然后,2 秒过后重新开始转发请求到上游服务,如果继续返回 `unhealthy.http_statuses` 状态码,记数再次达到 `unhealthy.failures` 次时,**熔断 4 秒**(倍数方式)。
+当上游服务处于不健康状态时,如果转发请求到上游服务并返回 `healthy.http_statuses` 配置中的状态码(比如:`200`),并达到 `healthy.successes` 次时,则认为上游服务恢复至健康状态。
 
-依次类推,2, 4, 8, 16, 32, 64, ..., 256,最大到 300。 300 是 `max_breaker_sec` 的最大值,允许自定义修改。
-
-在不健康状态时,当转发请求到上游服务并返回 `healthy.http_statuses` 配置中的状态码(比如:200),达到 `healthy.successes` 次时 (比如:3 次),认为上游服务恢复健康状态。
+:::
 
 ## 属性
 
 | 名称                    | 类型           | 必选项 | 默认值     | 有效值          | 描述                             |
 | ----------------------- | -------------- | ------ | ---------- | --------------- | -------------------------------- |
-| break_response_code     | integer        | 必须   | 无         | [200, ..., 599] | 不健康返回错误码                 |
-| break_response_body     | string         | 可选   | 无         |                 | 不健康返回报文                   |
-| break_response_headers  | array[object]  | 可选   | 无         | [{"key":"header_name","value":"can contain Nginx $var"}] | 不健康返回报文头,这里可以设置多个。该字段仅在 `break_response_body` 被配置时生效。这个值能够以 `$var` 的格式包含 APISIX 变量,比如 `{"key":"X-Client-Addr","value":"$remote_addr:$remote_port"}`。 |
-| max_breaker_sec         | integer        | 可选   | 300        | >=3             | 最大熔断持续时间                 |
-| unhealthy.http_statuses | array[integer] | 可选   | {500}      | [500, ..., 599] | 不健康时候的状态码               |
-| unhealthy.failures      | integer        | 可选   | 3          | >=1             | 在一定时间内触发不健康状态的异常请求次数 |
-| healthy.http_statuses   | array[integer] | 可选   | {200}      | [200, ..., 499] | 健康时候的状态码                 |
-| healthy.successes       | integer        | 可选   | 3          | >=1             | 触发健康状态的连续正常请求次数   |
+| break_response_code     | integer        | 是   |           | [200, ..., 599] | 当上游服务处于不健康状态时返回的 HTTP 错误码。                 |
+| break_response_body     | string         | 否   |           |                 | 当上游服务处于不健康状态时返回的 HTTP 响应体信息。                   |
+| break_response_headers  | array[object]  | 否   |           | [{"key":"header_name","value":"can contain Nginx $var"}] | 当上游服务处于不健康状态时返回的 HTTP 响应头信息。该字段仅在配置来 `break_response_body` 时生效,并能够以 `$var` 的格式包含 APISIX 变量,比如 `{"key":"X-Client-Addr","value":"$remote_addr:$remote_port"}`。 |
+| max_breaker_sec         | integer        | 否   | 300        | >=3             | 上游服务熔断的最大持续时间,以秒为单位。                 |
+| unhealthy.http_statuses | array[integer] | 否   | [500]      | [500, ..., 599] | 上游服务处于不健康状态时的 HTTP 状态码。               |
+| unhealthy.failures      | integer        | 否   | 3          | >=1             | 上游服务在一定时间内触发不健康状态的异常请求次数。 |
+| healthy.http_statuses   | array[integer] | 否   | [200]      | [200, ..., 499] | 上游服务处于健康状态时的 HTTP 状态码。                 |
+| healthy.successes       | integer        | 否   | 3          | >=1             | 上游服务触发健康状态的连续正常请求次数。   |
 
-## 启用方式
+## 启用插件
 
-这是一个示例,在指定的路由上启用 `api-breaker` 插件。
-在一定时间内应答 500 或 503 达到 3 次,触发熔断。应答 200 连续 1 次,恢复健康。
+以下示例展示了如何在指定路由上启用 `api-breaker` 插件,并设置在一定时间内返回 `500` 或 `503` 状态码达到 3 次后触发熔断,返回 `200` 状态码 1 次后恢复健康:

Review Comment:
   ```suggestion
   以下示例展示了如何在指定路由上启用 `api-breaker` 插件,该路由配置表示在一定时间内返回 `500` 或 `503` 状态码达到 3 次后触发熔断,返回 `200` 状态码 1 次后恢复健康:
   ```



##########
docs/en/latest/plugins/api-breaker.md:
##########
@@ -80,31 +84,37 @@ curl "http://127.0.0.1:9080/apisix/admin/routes/1" -H 'X-API-KEY: edd1c9f034335f
 }'
 ```
 
-In this configuration, a response code of 500 or 503 three times within a certain period of time triggers the unhealthy status of the Upstream service. A response code of 200 restores its healthy status.
+In this configuration, a response code of `500` or `503` three times within a certain period of time triggers the unhealthy status of the Upstream service. A response code of `200` restores its healthy status.
 
 ## Example usage
 
-Once you have configured the Plugin as shown above, you can test it out by sending a request. If the Upstream service responds with an unhealthy response code, you will receive the configured response code (`break_response_code`).
+Once you have configured the Plugin as shown above, you can test it out by sending a request.
 
 ```shell
 curl -i -X POST "http://127.0.0.1:9080/hello"
 ```
 
+If the Upstream service responds with an unhealthy response code, you will receive the configured response code (`break_response_code`).
+
 ```shell
 HTTP/1.1 502 Bad Gateway
-Content-Type: application/octet-stream
-Connection: keep-alive
-Server: APISIX/1.5
-
-... ...
+...
+<html>
+<head><title>502 Bad Gateway</title></head>
+<body>
+<center><h1>502 Bad Gateway</h1></center>
+<hr><center>openresty</center>
+</body>
+</html>
 ```
 
 ## Disable Plugin
 
 To disable the `api-breaker` Plugin, you can delete the corresponding JSON configuration from the Plugin configuration. APISIX will automatically reload and you do not have to restart for this to take effect.
 
 ```shell
-curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '

Review Comment:
   ```suggestion
   -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   ```



##########
docs/zh/latest/plugins/api-breaker.md:
##########
@@ -85,24 +88,33 @@ curl "http://127.0.0.1:9080/apisix/admin/routes/1" -H 'X-API-KEY: edd1c9f034335f
 
 ## 测试插件
 
-使用上游的配置,在一定时间内如果你的上流服务返回 500 达到 3 次。客户端将会收到 502(break_response_code)应答。
+按上述配置启用插件后,使用 `curl` 命令请求该路由:
 
 ```shell
 $ curl -i "http://127.0.0.1:9080/hello"
-HTTP/1.1 502 Bad Gateway
-Content-Type: application/octet-stream
-Connection: keep-alive
-Server: APISIX/1.5
+```
+
+如果上游服务在一定时间内返回 `500` 状态码达到 3 次,客户端将会收到 `502 Bad Gateway` 的应答:
 
-... ...
+```shell
+HTTP/1.1 502 Bad Gateway
+...
+<html>
+<head><title>502 Bad Gateway</title></head>
+<body>
+<center><h1>502 Bad Gateway</h1></center>
+<hr><center>openresty</center>
+</body>
+</html>
 ```
 
 ## 禁用插件
 
-当想禁用 `api-breaker` 插件时,非常简单,只需要在插件配置中删除相应的 json 配置,无需重启服务,即可立即生效:
+当你需要禁用该插件时,可以通过以下命令删除相应的 JSON 配置,APISIX 将会自动重新加载相关配置,无需重启服务:
 
 ```shell
-curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '

Review Comment:
   ```suggestion
   -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   ```



##########
docs/zh/latest/plugins/api-breaker.md:
##########
@@ -23,42 +28,40 @@ title: api-breaker
 
 ## 描述
 
-该插件实现 API 熔断功能,帮助我们保护上游业务服务。
+`api-breaker` 插件实现了 API 熔断功能,从而帮助我们保护上游业务服务。
 
-> 关于熔断超时逻辑
+:::note 注意
 
-由代码逻辑自动按**触发不健康状态**的次数递增运算:
+关于熔断超时逻辑,由代码逻辑自动按**触发不健康状态**的次数递增运算:
 
-每当上游服务返回 `unhealthy.http_statuses` 配置中的状态码(比如:500),达到 `unhealthy.failures` 次时 (比如:3 次),认为上游服务处于不健康状态。
+每当上游服务返回 `unhealthy.http_statuses` 配置中的状态码(比如:`500`),并达到 `unhealthy.failures` 次时,则认为上游服务处于不健康状态。
 
-第一次触发不健康状态,**熔断 2 秒**。
+第一次触发不健康状态,熔断 2 秒,然后重新开始转发请求到上游服务,如果继续返回 `unhealthy.http_statuses` 状态码,记数再次达到 `unhealthy.failures` 次时,熔断 4 秒。依次类推,2,4,8,16,最大到 `max_breaker_sec`。
 
-然后,2 秒过后重新开始转发请求到上游服务,如果继续返回 `unhealthy.http_statuses` 状态码,记数再次达到 `unhealthy.failures` 次时,**熔断 4 秒**(倍数方式)。
+当上游服务处于不健康状态时,如果转发请求到上游服务并返回 `healthy.http_statuses` 配置中的状态码(比如:`200`),并达到 `healthy.successes` 次时,则认为上游服务恢复至健康状态。
 
-依次类推,2, 4, 8, 16, 32, 64, ..., 256,最大到 300。 300 是 `max_breaker_sec` 的最大值,允许自定义修改。
-
-在不健康状态时,当转发请求到上游服务并返回 `healthy.http_statuses` 配置中的状态码(比如:200),达到 `healthy.successes` 次时 (比如:3 次),认为上游服务恢复健康状态。
+:::
 
 ## 属性
 
 | 名称                    | 类型           | 必选项 | 默认值     | 有效值          | 描述                             |
 | ----------------------- | -------------- | ------ | ---------- | --------------- | -------------------------------- |
-| break_response_code     | integer        | 必须   | 无         | [200, ..., 599] | 不健康返回错误码                 |
-| break_response_body     | string         | 可选   | 无         |                 | 不健康返回报文                   |
-| break_response_headers  | array[object]  | 可选   | 无         | [{"key":"header_name","value":"can contain Nginx $var"}] | 不健康返回报文头,这里可以设置多个。该字段仅在 `break_response_body` 被配置时生效。这个值能够以 `$var` 的格式包含 APISIX 变量,比如 `{"key":"X-Client-Addr","value":"$remote_addr:$remote_port"}`。 |
-| max_breaker_sec         | integer        | 可选   | 300        | >=3             | 最大熔断持续时间                 |
-| unhealthy.http_statuses | array[integer] | 可选   | {500}      | [500, ..., 599] | 不健康时候的状态码               |
-| unhealthy.failures      | integer        | 可选   | 3          | >=1             | 在一定时间内触发不健康状态的异常请求次数 |
-| healthy.http_statuses   | array[integer] | 可选   | {200}      | [200, ..., 499] | 健康时候的状态码                 |
-| healthy.successes       | integer        | 可选   | 3          | >=1             | 触发健康状态的连续正常请求次数   |
+| break_response_code     | integer        | 是   |           | [200, ..., 599] | 当上游服务处于不健康状态时返回的 HTTP 错误码。                 |
+| break_response_body     | string         | 否   |           |                 | 当上游服务处于不健康状态时返回的 HTTP 响应体信息。                   |
+| break_response_headers  | array[object]  | 否   |           | [{"key":"header_name","value":"can contain Nginx $var"}] | 当上游服务处于不健康状态时返回的 HTTP 响应头信息。该字段仅在配置来 `break_response_body` 时生效,并能够以 `$var` 的格式包含 APISIX 变量,比如 `{"key":"X-Client-Addr","value":"$remote_addr:$remote_port"}`。 |

Review Comment:
   ```suggestion
   | break_response_headers  | array[object]  | 否   |           | [{"key":"header_name","value":"can contain Nginx $var"}] | 当上游服务处于不健康状态时返回的 HTTP 响应头信息。该字段仅在配置了 `break_response_body` 属性时生效,并能够以 `$var` 的格式包含 APISIX 变量,比如 `{"key":"X-Client-Addr","value":"$remote_addr:$remote_port"}`。 |
   ```



##########
docs/zh/latest/plugins/api-breaker.md:
##########
@@ -23,42 +28,40 @@ title: api-breaker
 
 ## 描述
 
-该插件实现 API 熔断功能,帮助我们保护上游业务服务。
+`api-breaker` 插件实现了 API 熔断功能,从而帮助我们保护上游业务服务。
 
-> 关于熔断超时逻辑
+:::note 注意
 
-由代码逻辑自动按**触发不健康状态**的次数递增运算:
+关于熔断超时逻辑,由代码逻辑自动按**触发不健康状态**的次数递增运算:
 
-每当上游服务返回 `unhealthy.http_statuses` 配置中的状态码(比如:500),达到 `unhealthy.failures` 次时 (比如:3 次),认为上游服务处于不健康状态。
+每当上游服务返回 `unhealthy.http_statuses` 配置中的状态码(比如:`500`),并达到 `unhealthy.failures` 次时,则认为上游服务处于不健康状态。
 
-第一次触发不健康状态,**熔断 2 秒**。
+第一次触发不健康状态,熔断 2 秒,然后重新开始转发请求到上游服务,如果继续返回 `unhealthy.http_statuses` 状态码,记数再次达到 `unhealthy.failures` 次时,熔断 4 秒。依次类推,2,4,8,16,最大到 `max_breaker_sec`。
 
-然后,2 秒过后重新开始转发请求到上游服务,如果继续返回 `unhealthy.http_statuses` 状态码,记数再次达到 `unhealthy.failures` 次时,**熔断 4 秒**(倍数方式)。
+当上游服务处于不健康状态时,如果转发请求到上游服务并返回 `healthy.http_statuses` 配置中的状态码(比如:`200`),并达到 `healthy.successes` 次时,则认为上游服务恢复至健康状态。
 
-依次类推,2, 4, 8, 16, 32, 64, ..., 256,最大到 300。 300 是 `max_breaker_sec` 的最大值,允许自定义修改。
-
-在不健康状态时,当转发请求到上游服务并返回 `healthy.http_statuses` 配置中的状态码(比如:200),达到 `healthy.successes` 次时 (比如:3 次),认为上游服务恢复健康状态。
+:::
 
 ## 属性
 
 | 名称                    | 类型           | 必选项 | 默认值     | 有效值          | 描述                             |
 | ----------------------- | -------------- | ------ | ---------- | --------------- | -------------------------------- |
-| break_response_code     | integer        | 必须   | 无         | [200, ..., 599] | 不健康返回错误码                 |
-| break_response_body     | string         | 可选   | 无         |                 | 不健康返回报文                   |
-| break_response_headers  | array[object]  | 可选   | 无         | [{"key":"header_name","value":"can contain Nginx $var"}] | 不健康返回报文头,这里可以设置多个。该字段仅在 `break_response_body` 被配置时生效。这个值能够以 `$var` 的格式包含 APISIX 变量,比如 `{"key":"X-Client-Addr","value":"$remote_addr:$remote_port"}`。 |
-| max_breaker_sec         | integer        | 可选   | 300        | >=3             | 最大熔断持续时间                 |
-| unhealthy.http_statuses | array[integer] | 可选   | {500}      | [500, ..., 599] | 不健康时候的状态码               |
-| unhealthy.failures      | integer        | 可选   | 3          | >=1             | 在一定时间内触发不健康状态的异常请求次数 |
-| healthy.http_statuses   | array[integer] | 可选   | {200}      | [200, ..., 499] | 健康时候的状态码                 |
-| healthy.successes       | integer        | 可选   | 3          | >=1             | 触发健康状态的连续正常请求次数   |
+| break_response_code     | integer        | 是   |           | [200, ..., 599] | 当上游服务处于不健康状态时返回的 HTTP 错误码。                 |
+| break_response_body     | string         | 否   |           |                 | 当上游服务处于不健康状态时返回的 HTTP 响应体信息。                   |
+| break_response_headers  | array[object]  | 否   |           | [{"key":"header_name","value":"can contain Nginx $var"}] | 当上游服务处于不健康状态时返回的 HTTP 响应头信息。该字段仅在配置来 `break_response_body` 时生效,并能够以 `$var` 的格式包含 APISIX 变量,比如 `{"key":"X-Client-Addr","value":"$remote_addr:$remote_port"}`。 |
+| max_breaker_sec         | integer        | 否   | 300        | >=3             | 上游服务熔断的最大持续时间,以秒为单位。                 |
+| unhealthy.http_statuses | array[integer] | 否   | [500]      | [500, ..., 599] | 上游服务处于不健康状态时的 HTTP 状态码。               |
+| unhealthy.failures      | integer        | 否   | 3          | >=1             | 上游服务在一定时间内触发不健康状态的异常请求次数。 |
+| healthy.http_statuses   | array[integer] | 否   | [200]      | [200, ..., 499] | 上游服务处于健康状态时的 HTTP 状态码。                 |
+| healthy.successes       | integer        | 否   | 3          | >=1             | 上游服务触发健康状态的连续正常请求次数。   |
 
-## 启用方式
+## 启用插件
 
-这是一个示例,在指定的路由上启用 `api-breaker` 插件。
-在一定时间内应答 500 或 503 达到 3 次,触发熔断。应答 200 连续 1 次,恢复健康。
+以下示例展示了如何在指定路由上启用 `api-breaker` 插件,并设置在一定时间内返回 `500` 或 `503` 状态码达到 3 次后触发熔断,返回 `200` 状态码 1 次后恢复健康:
 
 ```shell
-curl "http://127.0.0.1:9080/apisix/admin/routes/1" -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+curl "http://127.0.0.1:9080/apisix/admin/routes/1" \
+  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '

Review Comment:
   ```suggestion
   -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   ```



##########
docs/en/latest/plugins/api-breaker.md:
##########
@@ -55,7 +58,8 @@ In an unhealthy state, if the Upstream service responds with a status code from
 The example below shows how you can configure the Plugin on a specific Route:
 
 ```shell
-curl "http://127.0.0.1:9080/apisix/admin/routes/1" -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+curl "http://127.0.0.1:9080/apisix/admin/routes/1" \
+  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '

Review Comment:
   ```suggestion
   -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   ```



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY merged pull request #7666: docs(plugin): refactor api-breaker.md

Posted by GitBox <gi...@apache.org>.
SylviaBABY merged PR #7666:
URL: https://github.com/apache/apisix/pull/7666


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] SylviaBABY commented on a diff in pull request #7666: docs(plugin): refactor api-breaker.md

Posted by GitBox <gi...@apache.org>.
SylviaBABY commented on code in PR #7666:
URL: https://github.com/apache/apisix/pull/7666#discussion_r945375419


##########
docs/zh/latest/plugins/api-breaker.md:
##########
@@ -23,42 +28,40 @@ title: api-breaker
 
 ## 描述
 
-该插件实现 API 熔断功能,帮助我们保护上游业务服务。
+`api-breaker` 插件实现了 API 熔断功能,从而帮助我们保护上游业务服务。
 
-> 关于熔断超时逻辑
+:::note 注意
 
-由代码逻辑自动按**触发不健康状态**的次数递增运算:
+关于熔断超时逻辑,由代码逻辑自动按**触发不健康状态**的次数递增运算:
 
-每当上游服务返回 `unhealthy.http_statuses` 配置中的状态码(比如:500),达到 `unhealthy.failures` 次时 (比如:3 次),认为上游服务处于不健康状态。
+每当上游服务返回 `unhealthy.http_statuses` 配置中的状态码(比如:`500`),并达到 `unhealthy.failures` 次时,则认为上游服务处于不健康状态。

Review Comment:
   ```suggestion
   当上游服务返回 `unhealthy.http_statuses` 配置中的状态码(默认为 `500`),并达到 `unhealthy.failures` 预设次数时(默认为 3 次),则认为上游服务处于不健康状态。
   ```



##########
docs/zh/latest/plugins/api-breaker.md:
##########
@@ -23,42 +28,40 @@ title: api-breaker
 
 ## 描述
 
-该插件实现 API 熔断功能,帮助我们保护上游业务服务。
+`api-breaker` 插件实现了 API 熔断功能,从而帮助我们保护上游业务服务。
 
-> 关于熔断超时逻辑
+:::note 注意
 
-由代码逻辑自动按**触发不健康状态**的次数递增运算:
+关于熔断超时逻辑,由代码逻辑自动按**触发不健康状态**的次数递增运算:
 
-每当上游服务返回 `unhealthy.http_statuses` 配置中的状态码(比如:500),达到 `unhealthy.failures` 次时 (比如:3 次),认为上游服务处于不健康状态。
+每当上游服务返回 `unhealthy.http_statuses` 配置中的状态码(比如:`500`),并达到 `unhealthy.failures` 次时,则认为上游服务处于不健康状态。
 
-第一次触发不健康状态,**熔断 2 秒**。
+第一次触发不健康状态,熔断 2 秒,然后重新开始转发请求到上游服务,如果继续返回 `unhealthy.http_statuses` 状态码,记数再次达到 `unhealthy.failures` 次时,熔断 4 秒。依次类推,2,4,8,16,最大到 `max_breaker_sec`。

Review Comment:
   ```suggestion
   第一次触发不健康状态时,熔断 2 秒。超过熔断时间后,将重新开始转发请求到上游服务,如果继续返回 `unhealthy.http_statuses` 状态码,记数再次达到 `unhealthy.failures` 预设次数时,熔断 4 秒。依次类推(2,4,8,16,……),直到达到预设的 `max_breaker_sec`值。
   ```



##########
docs/zh/latest/plugins/api-breaker.md:
##########
@@ -23,42 +28,40 @@ title: api-breaker
 
 ## 描述
 
-该插件实现 API 熔断功能,帮助我们保护上游业务服务。
+`api-breaker` 插件实现了 API 熔断功能,从而帮助我们保护上游业务服务。
 
-> 关于熔断超时逻辑
+:::note 注意
 
-由代码逻辑自动按**触发不健康状态**的次数递增运算:
+关于熔断超时逻辑,由代码逻辑自动按**触发不健康状态**的次数递增运算:
 
-每当上游服务返回 `unhealthy.http_statuses` 配置中的状态码(比如:500),达到 `unhealthy.failures` 次时 (比如:3 次),认为上游服务处于不健康状态。
+每当上游服务返回 `unhealthy.http_statuses` 配置中的状态码(比如:`500`),并达到 `unhealthy.failures` 次时,则认为上游服务处于不健康状态。
 
-第一次触发不健康状态,**熔断 2 秒**。
+第一次触发不健康状态,熔断 2 秒,然后重新开始转发请求到上游服务,如果继续返回 `unhealthy.http_statuses` 状态码,记数再次达到 `unhealthy.failures` 次时,熔断 4 秒。依次类推,2,4,8,16,最大到 `max_breaker_sec`。
 
-然后,2 秒过后重新开始转发请求到上游服务,如果继续返回 `unhealthy.http_statuses` 状态码,记数再次达到 `unhealthy.failures` 次时,**熔断 4 秒**(倍数方式)。
+当上游服务处于不健康状态时,如果转发请求到上游服务并返回 `healthy.http_statuses` 配置中的状态码(比如:`200`),并达到 `healthy.successes` 次时,则认为上游服务恢复至健康状态。

Review Comment:
   ```suggestion
   当上游服务处于不健康状态时,如果转发请求到上游服务并返回 `healthy.http_statuses` 配置中的状态码(默认为 `200`),并达到 `healthy.successes` 次时,则认为上游服务恢复至健康状态。
   ```



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org