bzp2010 commented on code in PR #12383:
URL: https://github.com/apache/apisix/pull/12383#discussion_r2224469840


##########
apisix/plugin.lua:
##########
@@ -808,18 +797,18 @@ do
 end
 
 
-function _M.init_worker()
+function _M.init_prometheus()
     local _, http_plugin_names, stream_plugin_names = get_plugin_names()
+    local enabled_in_http = core.table.array_find(http_plugin_names, 
"prometheus")
+    local enabled_in_stream = core.table.array_find(stream_plugin_names, 
"prometheus")
 
-    -- some plugins need to be initialized in init* phases
-    if is_http and core.table.array_find(http_plugin_names, "prometheus") then
-        local prometheus_enabled_in_stream =
-            core.table.array_find(stream_plugin_names, "prometheus")
-        
require("apisix.plugins.prometheus.exporter").http_init(prometheus_enabled_in_stream)
-    elseif not is_http and core.table.array_find(stream_plugin_names, 
"prometheus") then
-        require("apisix.plugins.prometheus.exporter").stream_init()
+    if is_http and (enabled_in_http or enabled_in_stream) then

Review Comment:
   It might be better to add a link to this PR comment here.
   
   https://github.com/apache/apisix/pull/12383/files#r2221993953



-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to