tzssangglass commented on issue #4160:
URL: https://github.com/apache/apisix/issues/4160#issuecomment-833468542


   @sandy420 good catch! welcome PR!
   
   I can reproduce it now
   
   step 1:create a plugin config
   
   ```
   curl http://127.0.0.1:9080/apisix/admin/plugin_configs/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
   {
       "desc": "blah",
       "plugins": {
           "prometheus":{}
       }
   }'
   ```
   
   step2: bind it to route
   ```
   curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
   {
       "uris": ["/hello"],
       "plugin_config_id": 1,
           "plugins": {
           "limit-count": {
           "count": 20,
           "time_window": 60,
           "rejected_code": 503
       }
       },
       "upstream": {
           "type": "roundrobin",
           "nodes": {
               "127.0.0.1:1980": 1
           }
       }
   }'
   ```
   
   step3: trigger route
   ```
   curl 127.0.0.1:9080/hello
   ```
   
   step4: request prometheus endpoint
   ```
   curl  http://127.0.0.1:9080/apisix/prometheus/metrics
   ```
   
   if it does not appear, repeat step4.
   
   the error.log is
   
   ```
   2021/05/06 20:00:17 [error] 32148#32148: *480 lua entry thread aborted: 
runtime error: /usr/local/apisix/apisix/plugins/prometheus/exporter.lua:209: 
attempt to compare number with string
   stack traceback:
   coroutine 0:
        /usr/local/apisix/apisix/plugins/prometheus/exporter.lua: in function 
'set_modify_index'
        /usr/local/apisix/apisix/plugins/prometheus/exporter.lua:232: in 
function 'etcd_modify_index'
        /usr/local/apisix/apisix/plugins/prometheus/exporter.lua:298: in 
function 'handler'
        /usr/local/apisix/apisix/api_router.lua:130: in function 'handler'
        /usr/local/apisix//deps/share/lua/5.1/resty/radixtree.lua:720: in 
function 'dispatch'
        /usr/local/apisix/apisix/api_router.lua:165: in function 'match'
        /usr/local/apisix/apisix/init.lua:292: in function 'http_access_phase'
        access_by_lua(nginx.conf:204):2: in main chunk, client: 127.0.0.1, 
server: , request: "GET /apisix/prometheus/metrics HTTP/1.1", host: 
"127.0.0.1:9080"
   ```
   
   this problem may be caused by 
https://github.com/apache/apisix/blob/b551f42d90d07598efd775fdeac392043534f8b4/apisix/plugin_config.lua#L65
   
   @spacewander pls take a look
   
   


-- 
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:
[email protected]


Reply via email to