diff --git a/apisix/cli/ngx_tpl.lua b/apisix/cli/ngx_tpl.lua index bfca1ccba5a2..3562cc7ec63c 100644 --- a/apisix/cli/ngx_tpl.lua +++ b/apisix/cli/ngx_tpl.lua @@ -334,6 +334,9 @@ http { {% if enabled_plugins["prometheus"] and not enabled_stream_plugins["prometheus"] then %} lua_shared_dict prometheus-metrics {* http.lua_shared_dict["prometheus-metrics"] *}; + {% if not use_apisix_base then %} + lua_shared_dict prometheus-cache {* meta.lua_shared_dict["prometheus-cache"] *}; + {% end %} {% end %} {% if enabled_plugins["skywalking"] then %} diff --git a/t/cli/test_prometheus_stream.sh b/t/cli/test_prometheus_stream.sh index d9cca32644eb..e3b86b57ebe1 100755 --- a/t/cli/test_prometheus_stream.sh +++ b/t/cli/test_prometheus_stream.sh @@ -60,7 +60,7 @@ sleep 1 # wait for sync out="$(curl http://127.0.0.1:9091/apisix/prometheus/metrics)" if ! echo "$out" | grep "apisix_stream_connection_total{route=\"1\"} 1" > /dev/null; then - echo "failed: prometheus can't work in stream subsystem" + echo "failed: prometheus can't work in both http & stream subsystem" exit 1 fi