ccxhwmy commented on code in PR #7412:
URL: https://github.com/apache/apisix/pull/7412#discussion_r917561342


##########
apisix/plugins/prometheus/exporter.lua:
##########
@@ -351,6 +356,42 @@ local function etcd_modify_index()
 
 end
 
+local key = {}
+local combine_param = {}
+
+local function shared_dict_status()
+    local header_of_shared_dict = core.request.header(ngx.ctx, "shared_dict")
+    if not header_of_shared_dict then
+        return
+    end
+
+    local set_shared_dict_param = function (shared_dict_name)
+        if type(shared_dict_name) ~= "string" then
+            return
+        end
+        local share_dict = ngx.shared[shared_dict_name]
+        if share_dict then
+            combine_param[1] = shared_dict_name
+            combine_param[2] = "capacity"
+            key[1] = concat_tab(combine_param, "_")
+            metrics.shared_dict:set(share_dict:capacity(), key)
+
+            combine_param[2] = "free_space"
+            key[1] = concat_tab(combine_param, "_")
+            metrics.shared_dict:set(share_dict:free_space(), key)
+        end
+    end

Review Comment:
   > can we move this function between `local combine_param = {}` and `local 
function shared_dict_status()`?
   
   can you tell me why do this?



-- 
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]

Reply via email to