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/02/09 23:54:53 UTC

[GitHub] [apisix] tao12345666333 opened a new issue #6276: bug: prometheus plugin `enable_export_server=false` not working as expected

tao12345666333 opened a new issue #6276:
URL: https://github.com/apache/apisix/issues/6276


   ### Issue description
   
   In the recent Apache APISIX Ingress controller CI, we found that the Prometheus plugin does not take effect when set via global_rules. (we using apache/apisix:dev docker image)
   
   **If we fallback this image to `apache/apisix:2.11.0-alpine` then it works fine.**
   
   Below is our configuration:
   
   ```yaml
   apisix:
     enable_control: true
     enable_reuseport: true          # Enable nginx SO_REUSEPORT switch if set to true.
     allow_admin:
       - 127.0.0.0/24
       - 0.0.0.0/0
     port_admin: 9180
     stream_proxy:                 # TCP/UDP proxy
       only: false
       tcp:                        # TCP proxy port list
         - 9100
       udp:
         - 9200
   etcd:
     host:                           # it's possible to define multiple etcd hosts addresses of the same etcd cluster.
       - "http://{{ .EtcdServiceFQDN }}:2379"     # multiple etcd address
     prefix: "/apisix"               # apisix configurations prefix
     timeout: 30                     # 30 seconds
   plugin_attr:
     prometheus:
       enable_export_server: false
   ```
   
   xref: https://github.com/apache/apisix-ingress-controller/issues/857
   
   ### Environment
   
   - apisix version (cmd: `apisix version`):  using dev image. `apache/apisix@sha256:6e6b8999a981ab00e1a1373fbebf049d08e15aeddfec8e5945910eba134e66c7`
   - OS (cmd: `uname -a`):
   - OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
   - etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
   - apisix-dashboard version, if have:
   - the plugin runner version, if the issue is about a plugin runner (cmd: depended on the kind of runner):
   - luarocks version, if the issue is about installation (cmd: `luarocks --version`):
   
   
   ### Steps to reproduce
   
   1. `git clone https://github.com/apache/apisix-ingress-controller.git`
   2. `make push-images-to-kind`
   3. `kubectl apply -k samples/deploy/crd`
   4. ` cd test/e2e/`
   5. `ginkgo --focus='enable prometheus'`
   
   ### Actual result
   
   `/apisix/prometheus/metrics` return 404
   
   ### Error log
   
   ```
   127.0.0.1 - - [09/Feb/2022:15:32:54 +0000] localhost:32150 "GET /apisix/admin/global_rules HTTP/1.1" 200 303 0.005 "-" "Go-http-client/1.1" - - - "http://localhost:32150"                                
   127.0.0.1 - - [09/Feb/2022:15:32:54 +0000] localhost:31883 "GET /apisix/prometheus/metrics HTTP/1.1" 404 47 0.000 "-" "Go-http-client/1.1" - - - "http://localhost:31883"
   ```
   
   ### Expected result
   
   `/apisix/prometheus/metrics`  return 200


-- 
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] tao12345666333 commented on issue #6276: bug: prometheus plugin `enable_export_server=false` not working as expected

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


   I see some test cases here
   https://github.com/apache/apisix/blob/defafb1e426c4ffe4aa740c9bb9ad26992fa2c2e/t/cli/test_prometheus.sh#L67-L105


-- 
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 closed issue #6276: bug: prometheus plugin `enable_export_server=false` not working as expected

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


   


-- 
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 issue #6276: bug: prometheus plugin `enable_export_server=false` not working as expected

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


   This is caused by the break change: https://github.com/apache/apisix/pull/6196
   The change is introduced to reduce attack vector.
   
   Let's add a new route with public-api plugin to work around it: https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/public-api.md


-- 
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] tao12345666333 commented on issue #6276: bug: prometheus plugin `enable_export_server=false` not working as expected

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


   I have tried three ways of configuration and they all work fine
   
   ```
   {
     "count": 3,
     "node": {
       "dir": true,
       "nodes": [
         {
           "modifiedIndex": 36,
           "value": {
             "status": 1,
             "update_time": 1644403772,
             "id": "1",
             "priority": 0,
             "plugins": {
               "public-api": {}
             },
             "uri": "/apisix/prometheus/metrics",
             "create_time": 1644403772
           },
           "createdIndex": 36,
           "key": "/apisix/routes/1"
         },
         {
           "modifiedIndex": 38,
           "value": {
             "upstream": {
               "pass_host": "pass",
               "nodes": {
                 "127.0.0.1:9091": 1
               },
               "scheme": "http",
               "type": "roundrobin",
               "hash_on": "vars"
             },
             "status": 1,
             "update_time": 1644404420,
             "id": "3",
             "priority": 0,
             "plugins": {
               "public-api": {
                 "uri": "/apisix/prometheus/metrics"
               }
             },
             "uri": "/pmetrics",
             "create_time": 1644404420
           },
           "createdIndex": 38,
           "key": "/apisix/routes/3"
         },
         {
           "modifiedIndex": 37,
           "value": {
             "status": 1,
             "update_time": 1644404184,
             "id": "2",
             "priority": 0,
             "plugins": {
               "public-api": {
                 "uri": "/apisix/prometheus/metrics"
               }
             },
             "uri": "/metrics",
             "create_time": 1644404184
           },
           "createdIndex": 37,
           "key": "/apisix/routes/2"
         }
       ],
       "key": "/apisix/routes"
     },
     "action": "get"
   }
   ```


-- 
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] tao12345666333 commented on issue #6276: bug: prometheus plugin `enable_export_server=false` not working as expected

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


   let me try to use `public_api` plugin.


-- 
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] tao12345666333 commented on issue #6276: bug: prometheus plugin `enable_export_server=false` not working as expected

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


   They are a logical AND relationship.
   
   Need to configure both `enable_export_server: false` and `public_api` plugin.


-- 
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] tao12345666333 edited a comment on issue #6276: bug: prometheus plugin `enable_export_server=false` not working as expected

Posted by GitBox <gi...@apache.org>.
tao12345666333 edited a comment on issue #6276:
URL: https://github.com/apache/apisix/issues/6276#issuecomment-1034411255


   @spacewander thanks for your reply.
   Does that mean these descriptions in the documentation are wrong? `enable_export_server=false` no longer have any real value?
   
   ```
   If you still want to expose the metrics via the data plane port (default: 9080), you can configure it like this:
   
   plugin_attr:
     prometheus:
       enable_export_server: false
   You may need to use [public-api](https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/public-api.md) plugin to expose it.
   ```
   
   https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/prometheus.md#api


-- 
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 closed issue #6276: bug: prometheus plugin `enable_export_server=false` not working as expected

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


   


-- 
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] tao12345666333 commented on issue #6276: bug: prometheus plugin `enable_export_server=false` not working as expected

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


   @spacewander thanks for your reply.
   Does that mean these descriptions in the documentation are wrong?
   
   ```
   If you still want to expose the metrics via the data plane port (default: 9080), you can configure it like this:
   
   plugin_attr:
     prometheus:
       enable_export_server: false
   You may need to use [public-api](https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/public-api.md) plugin to expose it.
   ```
   
   https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/prometheus.md#api


-- 
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 issue #6276: bug: prometheus plugin `enable_export_server=false` not working as expected

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


   > They are a logical AND relationship.
   > 
   > Need to configure both `enable_export_server: false` and `public_api` plugin.
   
   Yes
   
   
   
   > @spacewander thanks for your reply. Does that mean these descriptions in the documentation are wrong? `enable_export_server=false` no longer have any real value?
   > 
   > ```
   > If you still want to expose the metrics via the data plane port (default: 9080), you can configure it like this:
   > 
   > plugin_attr:
   >   prometheus:
   >     enable_export_server: false
   > You may need to use [public-api](https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/public-api.md) plugin to expose it.
   > ```
   > 
   > [https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/prometheus.md#api](https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/prometheus.md?rgh-link-date=2022-02-10T02%3A01%3A57Z#api)
   
   Look like we should fix the description of `You may need to use`.


-- 
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] tao12345666333 commented on issue #6276: bug: prometheus plugin `enable_export_server=false` not working as expected

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


   Submitted a PR to fix this description #6280 


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