You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "downtown12 (via GitHub)" <gi...@apache.org> on 2023/04/10 11:55:54 UTC

[GitHub] [apisix] downtown12 commented on issue #9280: help request: Can't import the built-in plugin `prometheus`, and error.log says 'exporter' is a number value

downtown12 commented on issue #9280:
URL: https://github.com/apache/apisix/issues/9280#issuecomment-1501732447

   Problem solved.
   The reason is a mistaken sequence I made, which cause LuaJIT choosing lua_package_path not as desire
   
   `/apisix-3.2.0/apisix/plugins/prometheus.lua:39: attempt to index local 'exporter' (a number value)`
   
   The reason of the error log above is that I add a `lua_extra_path` config to my `conf/config.yaml` file, which is:
   `extra_lua_path: "/chj/apisix-3.2.0/apisix/plugins/?.lua"`
   
   then when APISIX running, the `lua_package_path` becomes:
   `/chj/apisix-3.2.0/apisix/plugins/?.lua;/chj/apisix-3.2.0//deps/share/lua/5.1/?.lua;/chj/apisix-3.2.0//deps/share/lua/5.1/?/init.lua;...`
   
   so as the error stack shows, `apisix/plugins/prometheus/exporter.lua:20` tries to find the `prometheus` module.
   The lua-land will firstly try to find it in `/chj/apisix-3.2.0/apisix/plugins/?.lua`(the left head of `lua_package_path`), then `/chj/apisix-3.2.0//deps/share/lua/5.1/?.lua`.
   
   lua-land will hit `/chj/apisix-3.2.0/apisix/plugins/prometheus.lua` then use it. But the real file the `exporter.lua` wanna to find is `/chj/apisix-3.2.0//deps/share/lua/5.1/prometheus.lua`(The behind but the RIGHT module)...
   


-- 
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-unsubscribe@apisix.apache.org

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