request help: about prometheus metrics for deny access
Issue description
Question 1: monitoring address of apisix Prometheus: http://xx.yy.com/apisix/prometheus/metrics How does Prometheus restrict IP access or /apifix/Prometheus/ metrics to some monitoring servers Question 2: Prometheusmonitoring address: http://xx.yy.com/apisix/prometheus/metrics Can I reduce /apifix/Prometheus/metrics to /metrics
问题1:apisix prometheus 的监控地址:http://xx.yy.com/apisix/prometheus/metrics prometheus 怎么限制IP访问,或是全局的 /apisix/prometheus/metrics 限制到某些监控服务器上 问题2: 普米监控地址:http://xx.yy.com/apisix/prometheus/metrics 能否将 /apisix/prometheus/metrics 减缩为/metrics,要怎么做
Environment
- apisix version (cmd:
apisix version):apisix 1.5 - OS:centos 7
ping @membphis Do these two issues need a new feat to solve?
问题1:apisix prometheus 的监控地址:http://xx.yy.com/apisix/prometheus/metrics prometheus 怎么限制IP访问,或是全局的 /apisix/prometheus/metrics 限制到某些监控服务器上
you can take a look at this doc: https://github.com/apache/apisix/blob/master/doc/plugin-interceptors.md#plugin-interceptors
welcome to add this link to Prometheus plugin doc.
问题2: 普米监控地址:http://xx.yy.com/apisix/prometheus/metrics 能否将 /apisix/prometheus/metrics 减缩为/metrics,要怎么做
not support now. you need to update the source code of the plugin Prometheus.
another way, add a new field and allow the users to specify the export URI path.
问题2: 普米监控地址:http://xx.yy.com/apisix/prometheus/metrics 能否将 /apisix/prometheus/metrics 减缩为/metrics,要怎么做
support to specify the export path, how abou this way?
plugin_attr:
promethus:
export_uri: /apisix/prometheus/metrics
Look like we need to distinguish plugin attr (which need to reload to take effect) and plugin metadata (which don't need to reload). And we need to consider the plugin attr when we check if the plugin version is changed during loading plugins.
I think we can remove plugin_attr finally.
I love plugin metadata way.
for this issue, we can add new field export_uri: /apisix/prometheus/metrics via plugin metadata.
plugin attr is for configuration which need to take effect via the init function, like skywalking background timer and this one. It need to have the same lifecyle as the plugin lists (updated via reload). Therefore we can't remove it.
plugin attr is mainly for providing the default value, we can use the default value of plugin metadata to support this too.
here is an example: https://github.com/apache/apisix/blob/master/apisix/plugins/http-logger.lua#L61
if the admin user did not set any new value, then the plugin will use the default value(same as plugin attr).
if the admin user set a new value by plugin metadata API, then the plugin will use the new value.