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 2022/11/30 10:33:12 UTC

[GitHub] [apisix] tzssangglass opened a new pull request, #8434: feat(prometheus): support collect metrics works in the priviledged agent

tzssangglass opened a new pull request, #8434:
URL: https://github.com/apache/apisix/pull/8434

   ### Description
   
   <!-- Please include a summary of the change and which issue is fixed. -->
   <!-- Please also include relevant motivation and context. -->
   
   Fixes # (issue)
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [x] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


-- 
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] tzssangglass commented on a diff in pull request #8434: feat(prometheus): support collect metrics works in the priviledged agent

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #8434:
URL: https://github.com/apache/apisix/pull/8434#discussion_r1038975464


##########
apisix/plugins/prometheus/exporter.lua:
##########
@@ -410,7 +411,16 @@ local function shared_dict_status()
 end
 
 
+-- for test
+local function log_process_type()

Review Comment:
   done



-- 
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] membphis commented on a diff in pull request #8434: feat(prometheus): support collect metrics works in the priviledged agent

Posted by GitBox <gi...@apache.org>.
membphis commented on code in PR #8434:
URL: https://github.com/apache/apisix/pull/8434#discussion_r1037759709


##########
docs/en/latest/plugins/prometheus.md:
##########
@@ -102,6 +102,9 @@ plugin_attr:
 
 You can then expose it by using the [public-api](public-api.md) Plugin.
 
+Note:  If the Prometheus plugin collects too many metrics, it will take CPU resources to calculate the metric data when getting the metrics via URI, which may affect APISIX to process normal requests. To solve this problem, APISIX exposes the URI and calculates the metrics in the privileged agent.

Review Comment:
   More note: This feature requires users to use `apisix-base` instead of the official version of openresty.



-- 
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] tokers commented on a diff in pull request #8434: feat(prometheus): support collect metrics works in the priviledged agent

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #8434:
URL: https://github.com/apache/apisix/pull/8434#discussion_r1039068950


##########
docs/en/latest/plugins/prometheus.md:
##########
@@ -102,6 +102,15 @@ plugin_attr:
 
 You can then expose it by using the [public-api](public-api.md) Plugin.
 
+:::info IMPORTANT
+
+If the Prometheus plugin collects too many metrics, it will take CPU resources to calculate the metric data when getting the metrics via URI, which may affect APISIX to process normal requests. To solve this problem, APISIX exposes the URI and calculates the metrics in the privileged agent.

Review Comment:
   Add hyperlink for Privileged agent.



-- 
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] nanamikon commented on pull request #8434: feat(prometheus): support collect metrics works in the priviledged agent

Posted by "nanamikon (via GitHub)" <gi...@apache.org>.
nanamikon commented on PR #8434:
URL: https://github.com/apache/apisix/pull/8434#issuecomment-1570449787

   > Can you fix this problem in version 2.15? The main reason is that we have been using the official Docker image deployment. It seems that we cannot directly repair it by copying files, but we need to compile the underlying modules.
   
   +1


-- 
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 diff in pull request #8434: feat(prometheus): support collect metrics works in the priviledged agent

Posted by GitBox <gi...@apache.org>.
spacewander commented on code in PR #8434:
URL: https://github.com/apache/apisix/pull/8434#discussion_r1037829428


##########
apisix/plugins/prometheus/exporter.lua:
##########
@@ -410,7 +411,16 @@ local function shared_dict_status()
 end
 
 
+-- for test
+local function log_process_type()

Review Comment:
   A hook example: https://github.com/apache/apisix/blob/797bc7dbcce37eb565bb7a5207534455f90dcf82/t/cli/test_main.sh#L624



##########
apisix/plugins/prometheus/exporter.lua:
##########
@@ -410,7 +411,16 @@ local function shared_dict_status()
 end
 
 
+-- for test
+local function log_process_type()

Review Comment:
   We can hook the `_M.collect` to avoid adding logging just for testing.



-- 
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 #8434: feat(prometheus): support collect metrics works in the priviledged agent

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


-- 
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] jagerzhang commented on pull request #8434: feat(prometheus): support collect metrics works in the priviledged agent

Posted by "jagerzhang (via GitHub)" <gi...@apache.org>.
jagerzhang commented on PR #8434:
URL: https://github.com/apache/apisix/pull/8434#issuecomment-1463336009

   Can you fix this problem in version 2.15? The main reason is that we have been using the official Docker image deployment. It seems that we cannot directly repair it by copying files, but we need to compile the underlying modules.


-- 
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] tzssangglass commented on a diff in pull request #8434: feat(prometheus): support collect metrics works in the priviledged agent

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #8434:
URL: https://github.com/apache/apisix/pull/8434#discussion_r1039092618


##########
docs/en/latest/plugins/prometheus.md:
##########
@@ -102,6 +102,15 @@ plugin_attr:
 
 You can then expose it by using the [public-api](public-api.md) Plugin.
 
+:::info IMPORTANT
+
+If the Prometheus plugin collects too many metrics, it will take CPU resources to calculate the metric data when getting the metrics via URI, which may affect APISIX to process normal requests. To solve this problem, APISIX exposes the URI and calculates the metrics in the privileged agent.

Review Comment:
   done



-- 
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 diff in pull request #8434: feat(prometheus): support collect metrics works in the priviledged agent

Posted by GitBox <gi...@apache.org>.
spacewander commented on code in PR #8434:
URL: https://github.com/apache/apisix/pull/8434#discussion_r1039166520


##########
example/apisix/plugins/prometheus/exporter.lua:
##########
@@ -0,0 +1,34 @@
+--

Review Comment:
   As this file is test-only, we can move it under t/lib?



##########
apisix/cli/ngx_tpl.lua:
##########
@@ -75,12 +75,27 @@ http {
                       .. [=[{*lua_cpath*};";
 
     {% if enabled_stream_plugins["prometheus"] then %}
+
+    init_by_lua_block {
+        require "resty.core"
+        apisix = require("apisix")

Review Comment:
   I double-checked this line and it seems the `apisix` is not used?



-- 
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] tzssangglass commented on a diff in pull request #8434: feat(prometheus): support collect metrics works in the priviledged agent

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #8434:
URL: https://github.com/apache/apisix/pull/8434#discussion_r1037766764


##########
docs/en/latest/plugins/prometheus.md:
##########
@@ -102,6 +102,9 @@ plugin_attr:
 
 You can then expose it by using the [public-api](public-api.md) Plugin.
 
+Note:  If the Prometheus plugin collects too many metrics, it will take CPU resources to calculate the metric data when getting the metrics via URI, which may affect APISIX to process normal requests. To solve this problem, APISIX exposes the URI and calculates the metrics in the privileged agent.

Review Comment:
   done



-- 
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] tzssangglass commented on a diff in pull request #8434: feat(prometheus): support collect metrics works in the priviledged agent

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #8434:
URL: https://github.com/apache/apisix/pull/8434#discussion_r1039181683


##########
apisix/cli/ngx_tpl.lua:
##########
@@ -75,12 +75,27 @@ http {
                       .. [=[{*lua_cpath*};";
 
     {% if enabled_stream_plugins["prometheus"] then %}
+
+    init_by_lua_block {
+        require "resty.core"
+        apisix = require("apisix")

Review Comment:
   remove it, and this helped me to solve the problem of repeatedly requiring apisix, thanks.



-- 
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] tzssangglass commented on a diff in pull request #8434: feat(prometheus): support collect metrics works in the priviledged agent

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #8434:
URL: https://github.com/apache/apisix/pull/8434#discussion_r1039181257


##########
example/apisix/plugins/prometheus/exporter.lua:
##########
@@ -0,0 +1,34 @@
+--

Review Comment:
   done



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