moonming commented on a change in pull request #1888:
URL: https://github.com/apache/incubator-apisix/pull/1888#discussion_r459811000
##########
File path: apisix/plugins/prometheus/exporter.lua
##########
@@ -152,9 +165,70 @@ local function nginx_status()
label_values[1] = name
metrics.connections:set(val[0], label_values)
+
end
end
+local key_values = {}
+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
+ end
+ end
+ end
+
+ key_values[1] = key
+ metrics.etcd_modify_indexes:set(max_idx, key_values)
+
+
+ global_max_index = max_idx > global_max_index and max_idx or
global_max_index
+
+ return global_max_index
+end
+local function etcd_modify_index()
Review comment:
need test cases for this function
----------------------------------------------------------------
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:
[email protected]