You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/07/07 08:10:14 UTC

[GitHub] [apisix] billnote opened a new issue #4552: bug: request prometheus metrics. throw etcd key not found: [/routes] warning

billnote opened a new issue #4552:
URL: https://github.com/apache/apisix/issues/4552


   ### Issue description
   request prometheus metrics api.  throw etcd key not found: [/routes] warning
   
   ### Environment
   
   Bug report without environment information will be ignored or closed.
   
   * apisix version (cmd: `apisix version`): 2.5 (i think all the version has this bug)
   * OS (cmd: `uname -a`): Linux  3.10.0-1160.el7.x86_64
   * OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):  nginx version: openresty/1.19.3.2
   * etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API): etcd-release-3.4.13
   
   ### Minimal test code / Steps to reproduce the issue
   
   Bug report without steps to reproduce will be ignored or closed.
   
   1. request prometheus metrics api
   2. error.log has this warn:  >>>>>> etcd key not found: [/routes] <<<<<
   


-- 
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] billnote commented on issue #4552: bug: request prometheus metrics. throw etcd key not found: [/routes] warning

Posted by GitBox <gi...@apache.org>.
billnote commented on issue #4552:
URL: https://github.com/apache/apisix/issues/4552#issuecomment-875394437


   This line of code causes the bug.
   [https://github.com/apache/apisix/blob/3602646ff7a46b10db58741763f413b40f8d9547/apisix/plugins/prometheus/exporter.lua#L311](url)
   
   Because etcd key has the prefix in default config. Use below code to solve this bug:
   ```
           local key = "/routes/"
           local local_conf = core.config.local_conf()
           if local_conf.etcd and local_conf.etcd.prefix then
               key = local_conf.etcd.prefix .. key
           end
           
           local res, _ = config:getkey(key)
   ```


-- 
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] billnote commented on issue #4552: bug: request prometheus metrics. throw etcd key not found: [/routes] warning

Posted by GitBox <gi...@apache.org>.
billnote commented on issue #4552:
URL: https://github.com/apache/apisix/issues/4552#issuecomment-875393686


   This line of code causes the bug.
   [https://github.com/apache/apisix/blob/3602646ff7a46b10db58741763f413b40f8d9547/apisix/plugins/prometheus/exporter.lua#L311](url)
   
   Because etcd key has the prefix in default config. Use below code to solve this bug:
   ```
           local key = "/routes/"
           local local_conf = core.config.local_conf()
           if local_conf.etcd and local_conf.etcd.prefix then
               key = local_conf.etcd.prefix .. key
           end
           
           local res, _ = config:getkey(key)
   ```


-- 
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] billnote removed a comment on issue #4552: bug: request prometheus metrics. throw etcd key not found: [/routes] warning

Posted by GitBox <gi...@apache.org>.
billnote removed a comment on issue #4552:
URL: https://github.com/apache/apisix/issues/4552#issuecomment-875393686






-- 
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] billnote commented on issue #4552: bug: request prometheus metrics. throw etcd key not found: [/routes] warning

Posted by GitBox <gi...@apache.org>.
billnote commented on issue #4552:
URL: https://github.com/apache/apisix/issues/4552#issuecomment-875393137


   This line of code causes the bug.
   [https://github.com/apache/apisix/blob/3602646ff7a46b10db58741763f413b40f8d9547/apisix/plugins/prometheus/exporter.lua#L311](url)
   
   Because etcd key has the prefix in default config. Use below code to solve this bug:
   ```
           local key = "/routes/"
           local local_conf = core.config.local_conf()
           if local_conf.etcd and local_conf.etcd.prefix then
               key = local_conf.etcd.prefix .. key
           end
           
           local res, _ = config:getkey(key)
   ```


-- 
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] Yiyiyimu commented on issue #4552: bug: request prometheus metrics. throw etcd key not found: [/routes] warning

Posted by GitBox <gi...@apache.org>.
Yiyiyimu commented on issue #4552:
URL: https://github.com/apache/apisix/issues/4552#issuecomment-875742336


   @billnote do you mind propose a PR to fix it~


-- 
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] billnote closed issue #4552: bug: request prometheus metrics. throw etcd key not found: [/routes] warning

Posted by GitBox <gi...@apache.org>.
billnote closed issue #4552:
URL: https://github.com/apache/apisix/issues/4552


   


-- 
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] billnote commented on issue #4552: bug: request prometheus metrics. throw etcd key not found: [/routes] warning

Posted by GitBox <gi...@apache.org>.
billnote commented on issue #4552:
URL: https://github.com/apache/apisix/issues/4552#issuecomment-876088074


   ok, i will open a PR later


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