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/08 03:13:52 UTC

[GitHub] [apisix] billnote opened a new pull request #4561: fix: metrics api etcd key not found warning

billnote opened a new pull request #4561:
URL: https://github.com/apache/apisix/pull/4561


   ### What this PR does / why we need it:
   <!--- Why is this change required? What problem does it solve? -->
   <!--- If it fixes an open issue, please link to the issue here. -->
   fix: [https://github.com/apache/apisix/issues/4552](url)
   
   ### Pre-submission checklist:
   
   * [ ] Did you explain what problem does this PR solve? Or what new features have been added?
   * [ ] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [ ] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first**
   


-- 
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] spacewander merged pull request #4561: feat: add prefix when using config_etcd:getkeys

Posted by GitBox <gi...@apache.org>.
spacewander merged pull request #4561:
URL: https://github.com/apache/apisix/pull/4561


   


-- 
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] spacewander commented on pull request #4561: fix: metrics api etcd key not found warning

Posted by GitBox <gi...@apache.org>.
spacewander commented on pull request #4561:
URL: https://github.com/apache/apisix/pull/4561#issuecomment-876276227


   Where do you find "etcd key not found"  in the error log?
   
   After consulting with the author of this feature, look like it doesn't require a real key. Actually, request any key from etcd will return the "X-Etcd-Index". A non-existed key is preferred because it doesn't return too much data, as we only care about the header.


-- 
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 a change in pull request #4561: fix: metrics api etcd key not found warning

Posted by GitBox <gi...@apache.org>.
billnote commented on a change in pull request #4561:
URL: https://github.com/apache/apisix/pull/4561#discussion_r666626119



##########
File path: apisix/core/config_etcd.lua
##########
@@ -71,6 +71,11 @@ local function getkey(etcd_cli, key)
         return nil, "not inited"
     end
 
+    local local_conf, _ = config_local.local_conf()
+    if local_conf and local_conf.etcd and local_conf.etcd.prefix then
+        key = local_conf.etcd.prefix .. key
+    end

Review comment:
       ok




-- 
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 pull request #4561: fix: metrics api etcd key not found warning

Posted by GitBox <gi...@apache.org>.
billnote commented on pull request #4561:
URL: https://github.com/apache/apisix/pull/4561#issuecomment-876300273


   Sorry, I check the code, This waring will only appear in our internal version.
   
   But  getKey function  don't need add prefix automatically?  I will close this PR, if we don't need.
   
   


-- 
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] spacewander commented on a change in pull request #4561: fix: metrics api etcd key not found warning

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #4561:
URL: https://github.com/apache/apisix/pull/4561#discussion_r665856352



##########
File path: apisix/plugins/prometheus/exporter.lua
##########
@@ -308,7 +308,13 @@ function _M.collect()
                            "processing metrics endpoint: ", err)
         end
 
-        local res, _ = config:getkey("/routes")
+        local key = "/routes/"
+        local local_conf = core.config.local_conf()

Review comment:
       Better to move it into getkey




-- 
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] spacewander commented on a change in pull request #4561: fix: metrics api etcd key not found warning

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #4561:
URL: https://github.com/apache/apisix/pull/4561#discussion_r666654749



##########
File path: apisix/plugins/prometheus/exporter.lua
##########
@@ -308,7 +308,8 @@ function _M.collect()
                            "processing metrics endpoint: ", err)
         end
 
-        local res, _ = config:getkey("/routes")
+        -- use phantom key to get etcd index

Review comment:
       The comment is too short compared with my explanation




-- 
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] spacewander commented on a change in pull request #4561: fix: metrics api etcd key not found warning

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #4561:
URL: https://github.com/apache/apisix/pull/4561#discussion_r666137101



##########
File path: apisix/core/config_etcd.lua
##########
@@ -71,6 +71,11 @@ local function getkey(etcd_cli, key)
         return nil, "not inited"
     end
 
+    local local_conf, _ = config_local.local_conf()

Review comment:
       ```suggestion
       local local_conf = config_local.local_conf()
   ```

##########
File path: apisix/plugins/prometheus/exporter.lua
##########
@@ -308,7 +308,7 @@ function _M.collect()
                            "processing metrics endpoint: ", err)
         end
 
-        local res, _ = config:getkey("/routes")
+        local res, _ = config:getkey("/routes/")

Review comment:
       Let's change the key name.

##########
File path: apisix/core/config_etcd.lua
##########
@@ -71,6 +71,11 @@ local function getkey(etcd_cli, key)
         return nil, "not inited"
     end
 
+    local local_conf, _ = config_local.local_conf()
+    if local_conf and local_conf.etcd and local_conf.etcd.prefix then
+        key = local_conf.etcd.prefix .. key
+    end

Review comment:
       Should be added to _M.getkey?




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