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 09:50:42 UTC

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

downtown12 opened a new issue, #9280:
URL: https://github.com/apache/apisix/issues/9280

   ### Description
   
   APISIX Version: 3.2.0
   deployment: from source code. Has run `make install` and succeed returned
   
   config.yaml(snippets):
   ```
    plugins:
        - prometheus
        - file-logger
   ``` 
   
   start command: apisix start
   
   error detail(from error.log):
   ```
   2023/04/10 16:17:58 [error] 1320262#1320262: init_worker_by_lua error: /chj/apisix-3.2.0/apisix/plugins/prometheus.lua:39: attempt to index local 'exporter' (a number value)
   stack traceback:
   	/chj/apisix-3.2.0/apisix/plugins/prometheus.lua:39: in main chunk
   	[C]: in function 'require'
   	/chj/apisix-3.2.0/apisix/plugins/prometheus/exporter.lua:20: in main chunk
   	[C]: in function 'require'
   	/chj/apisix-3.2.0/apisix/plugin.lua:740: in function 'init_worker'
   	/chj/apisix-3.2.0/apisix/init.lua:148: in function 'http_init_worker'
   	init_worker_by_lua:2: in main chunk
   ```
   
   
   it seems `apisix/plugins/prometheus/exporter.lua:20` want to `require ('prometheus')` but failed.
   however, the `prometheus` lua module is actually already in my lua_package_path, which is 
   ```
   "/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;
   ``` 
   
   when I use APISIX 3.1.0(while the other conditions keep unchanged), the error diapears.
   I wonder whether some changes in APISIX 3.2.0 makes this error 
   
   
   ### Environment
   
   - APISIX version (run `apisix version`): 3.2.0
   - Operating system (run `uname -a`): 3.10.0-1062.9.1.el7.x86_64
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): nginx version: openresty/1.21.4.1
   - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`): NA
   - APISIX Dashboard version, if relevant: NA
   - Plugin runner version, for issues related to plugin runners: NA
   - LuaRocks version, for installation issues (run `luarocks --version`): 3.8.0
   


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

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


[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

Posted by "downtown12 (via GitHub)" <gi...@apache.org>.
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


[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

Posted by "downtown12 (via GitHub)" <gi...@apache.org>.
downtown12 commented on issue #9280:
URL: https://github.com/apache/apisix/issues/9280#issuecomment-1501745161

   Still don't know why this bug not exposed in my 3.1.0 env...


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


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

Posted by "downtown12 (via GitHub)" <gi...@apache.org>.
downtown12 closed issue #9280: help request: Can't import the built-in plugin `prometheus`, and error.log says 'exporter' is a number value
URL: https://github.com/apache/apisix/issues/9280


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