You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by me...@apache.org on 2020/08/11 04:29:59 UTC
[apisix] branch master updated: bugfix: comparing etcd key's
modifiedIndex as a number may cause an error when access to prometheus
exporter api (#2035)
This is an automated email from the ASF dual-hosted git repository.
membphis 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 04c2708 bugfix: comparing etcd key's modifiedIndex as a number may cause an error when access to prometheus exporter api (#2035)
04c2708 is described below
commit 04c270814a1c0a188e5806602e1b62a47f90885e
Author: nic-chen <33...@users.noreply.github.com>
AuthorDate: Tue Aug 11 12:29:50 2020 +0800
bugfix: comparing etcd key's modifiedIndex as a number may cause an error when access to prometheus exporter api (#2035)
fix #2025
---
apisix/plugins/prometheus/exporter.lua | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/apisix/plugins/prometheus/exporter.lua b/apisix/plugins/prometheus/exporter.lua
index 7e3d63e..8e6d74d 100644
--- a/apisix/plugins/prometheus/exporter.lua
+++ b/apisix/plugins/prometheus/exporter.lua
@@ -178,8 +178,11 @@ local function set_modify_index(key, items, items_ver, global_max_index)
local max_idx = 0
if items_ver and items then
for _, item in ipairs(items) do
- if type(item) == "table" and item.modifiedIndex > max_idx then
- max_idx = item.modifiedIndex
+ if type(item) == "table" then
+ local modify_index = item.modifiedIndex_org or item.modifiedIndex
+ if modify_index > max_idx then
+ max_idx = modify_index
+ end
end
end
end