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


##########
docs/en/latest/plugins/prometheus.md:
##########
@@ -272,6 +273,48 @@ 
apisix_http_latency_bucket{type="upstream",route="1",service="",consumer="",node
 # HELP apisix_node_info Info of APISIX node
 # TYPE apisix_node_info gauge
 apisix_node_info{hostname="desktop-2022q8f-wsl"} 1
+# HELP apisix_shared_dict_capacity_bytes The capacity of each nginx shared 
DICT since APISIX start
+# TYPE apisix_shared_dict_capacity_bytes gauge
+apisix_shared_dict_capacity_bytes{name="access-tokens"} 1048576
+apisix_shared_dict_capacity_bytes{name="balancer-ewma"} 10485760

Review Comment:
   Let's use `...` here to make doc compact



##########
apisix/plugins/prometheus/exporter.lua:
##########
@@ -352,13 +361,28 @@ local function etcd_modify_index()
 end
 
 
+local function shared_dict_status()
+    local name = {}
+    for shared_dict_name, shared_dict in pairs(ngx.shared) do
+        if shared_dict then

Review Comment:
   What does the if check do for?



##########
t/plugin/prometheus.t:
##########
@@ -632,3 +632,53 @@ GET /apisix/prometheus/metrics
 qr/apisix_/
 --- response_body_unlike eval
 qr/etcd/
+
+
+
+=== TEST 42: fetch the prometheus one shared dict data storage with string
+--- yaml_config
+nginx_config:
+  http:
+    lua_shared_dict:
+      internal-status: 10m
+--- request
+GET /apisix/prometheus/metrics
+--- response_body_like eval
+qr/.*apisix_shared_dict_capacity_bytes{name="internal-status"} \d+(?:.|\n)*
+apisix_shared_dict_free_space_bytes{name="internal-status"} \d+.*/
+
+
+
+=== TEST 43: fetch the prometheus multiple shared dict data
+--- yaml_config
+nginx_config:
+  http:
+    lua_shared_dict:
+      worker-events: 10m
+      upstream-healthcheck: 10m
+      internal-status: 10m
+--- request eval
+["GET /apisix/prometheus/metrics", "GET /apisix/prometheus/metrics", "GET 
/apisix/prometheus/metrics"]
+--- response_body_like eval
+[qr/.*apisix_shared_dict_capacity_bytes{name="worker-events"} \d+(?:.|\n)*
+apisix_shared_dict_free_space_bytes{name="worker-events"} \d+.*/,
+qr/.*apisix_shared_dict_capacity_bytes{name="upstream-healthcheck"} 
\d+(?:.|\n)*
+apisix_shared_dict_free_space_bytes{name="upstream-healthcheck"} \d+.*/,
+qr/.*apisix_shared_dict_capacity_bytes{name="internal-status"} \d+(?:.|\n)*
+apisix_shared_dict_free_space_bytes{name="internal-status"} \d+.*/]
+
+
+
+=== TEST 44: fetch the prometheus multiple shared dict data contain not exist 
shared dict
+--- yaml_config

Review Comment:
   > Here it can be verified that yaml_config is not sufficient condition.
   
   We already have some lua_shared_dict defined in the yaml by default. Is it 
necessary to override the default yaml to verify it?



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