This is an automated email from the ASF dual-hosted git repository.

monkeydluffy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new b9d2dbf54 fix: mostly_healthy is considered as healthy (#10639)
b9d2dbf54 is described below

commit b9d2dbf545bc052309baa074c637d4c41dc09c72
Author: Sn0rt <wangguohao.2...@gmail.com>
AuthorDate: Thu Dec 21 16:35:13 2023 +0800

    fix: mostly_healthy is considered as healthy (#10639)
---
 apisix/control/v1.lua                  | 2 +-
 apisix/plugins/prometheus/exporter.lua | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/apisix/control/v1.lua b/apisix/control/v1.lua
index 3143ae594..6838ee4cb 100644
--- a/apisix/control/v1.lua
+++ b/apisix/control/v1.lua
@@ -130,7 +130,7 @@ local HTML_TEMPLATE = [[
 {% for _, stat in ipairs(stats) do %}
 {% for _, node in ipairs(stat.nodes) do %}
 {% i = i + 1 %}
-  {% if node.status == "healthy" then %}
+  {% if node.status == "healthy" or node.status == "mostly_healthy" then %}
   <tr>
   {% else %}
   <tr bgcolor="#FF0000">
diff --git a/apisix/plugins/prometheus/exporter.lua 
b/apisix/plugins/prometheus/exporter.lua
index f795a27a0..50736241b 100644
--- a/apisix/plugins/prometheus/exporter.lua
+++ b/apisix/plugins/prometheus/exporter.lua
@@ -475,8 +475,10 @@ local function collect(ctx, stream_only)
     local stats = control.get_health_checkers()
     for _, stat in ipairs(stats) do
         for _, node in ipairs(stat.nodes) do
-            metrics.upstream_status:set((node.status == "healthy") and 1 or 0,
-                gen_arr(stat.name, node.ip, node.port))
+            metrics.upstream_status:set(
+                    (node.status == "healthy" or node.status == 
"mostly_healthy") and 1 or 0,
+                    gen_arr(stat.name, node.ip, node.port)
+            )
         end
     end
 

Reply via email to