Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apisix/cli/ngx_tpl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
2 changes: 1 addition & 1 deletion t/cli/test_prometheus_stream.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional testing is needed; the existing tests cannot verify whether prometheus-cache is correctly generated when use_apisix_base=false.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find out how to set use_apisix_base=false in ut environment, it's setted in env.lua:

    local use_apisix_base = true
    if not or_info:find("apisix-nginx-module", 1, true) then
        use_apisix_base = false
    end

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the existing tests and didn't find anything related to use_apisix_base=false, so I think this is acceptable. Let's see what other maintainers think.

exit 1
fi

Expand Down
Loading