yangxikun opened a new issue #3286:
URL: https://github.com/apache/apisix/issues/3286


   ### Issue description
   
   Our custom plugins rely on 
`apisix.plugins.prometheus.exporter.get_prometheus()` return an initialized 
prometheus instance to create metrics. 
   
   ### Environment
   
   * apisix version (cmd: `apisix version`): 2.2
   
   ### What's the actual result? (including assertion message & call stack if 
applicable)
   
   When apisix start, custom plugins init first, and 
`apisix.plugins.prometheus.exporter.get_prometheus()` return nil, cause error 
`attempt to index a nil value`.
   
   apisix/plugin.lua: 
   
   ```lua
   function _M.init_worker()
       _M.load()
   
       -- some plugins need to be initialized in init* phases
       if ngx.config.subsystem == "http" then
           require("apisix.plugins.prometheus.exporter").init()
       end
   
       ......
   
   end
   ```
   


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

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


Reply via email to