nacos
nacos copied to clipboard
Prometheus-sd add namespace and service api
Is your feature request related to a problem? Please describe. If use Nacos for Prometheus http sd. Prometheus will get all services in Nacos. But in many scene, Nacos is use by a lot system. So prometheus sd support Namespace and service dimention insulate are important.
Describe the solution you'd like Add two api.
Describe alternatives you've considered Add two interfaces, and specify the Namespace and the service
Is prometheus sd protocol support specify the Namespace and the service?
Actually, prometheus do not support Nacos as service discovery directly. Currently, we can only use Prometheus Http SD config for Nacos, see this issue: https://github.com/prometheus/prometheus/issues/7539 . And prometheus don't really care what api path you give, so we can config namespace and service through path variable.
Prometheus http sd: https://prometheus.io/docs/prometheus/latest/http_sd/
我的想法是做一个@PrometheusParam的注解,然后value可以是${namespace}|${group}的占位符,用AspectJ去做切面替换占位符,然后以参数形式注入到不同的prometheus监控中,这样别的接口也可以使用,扩展起来方便,是否可行 @KomachiSion
我的想法是做一个@PrometheusParam的注解,然后value可以是${namespace}|${group}的占位符,用AspectJ去做切面替换占位符,然后以参数形式注入到不同的prometheus监控中,这样别的接口也可以使用,扩展起来方便,是否可行 @KomachiSion
没必要这么复杂, 如果prometheus sd 不关心具体的uri是什么,那完全可以提供全量的,命名空间级别,服务级别的接口精确控制, 甚至应该限制使用命名空间级别,服务级别,减少全量接口的使用。
Actually, prometheus do not support Nacos as service discovery directly. Currently, we can only use Prometheus Http SD config for Nacos, see this issue: prometheus/prometheus#7539 . And prometheus don't really care what api path you give, so we can config namespace and service through path variable.
Prometheus http sd: https://prometheus.io/docs/prometheus/latest/http_sd/
I don't know much about the prometheus sd protocol. From the documentation, I can only see that target hosts are required to be configured, so I always thought it was a fixed uri. Not sure how to configure the uri.
If it is the uri that can be customized, then specifying the namespace and serviceName should be the recommended practice
我的想法是做一个@PrometheusParam的注解,然后value可以是${namespace}|${group}的占位符,用AspectJ去做切面替换占位符,然后以参数形式注入到不同的prometheus监控中,这样别的接口也可以使用,扩展起来方便,是否可行 @KomachiSion
没必要这么复杂, 如果prometheus sd 不关心具体的uri是什么,那完全可以提供全量的,命名空间级别,服务级别的接口精确控制, 甚至应该限制使用命名空间级别,服务级别,减少全量接口的使用。
get
Actually, prometheus do not support Nacos as service discovery directly. Currently, we can only use Prometheus Http SD config for Nacos, see this issue: prometheus/prometheus#7539 . And prometheus don't really care what api path you give, so we can config namespace and service through path variable. Prometheus http sd: https://prometheus.io/docs/prometheus/latest/http_sd/
I don't know much about the prometheus sd protocol. From the documentation, I can only see that target hosts are required to be configured, so I always thought it was a fixed uri. Not sure how to configure the uri.
If it is the uri that can be customized, then specifying the namespace and serviceName should be the recommended practice
sry, posted wrong doc, see this: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#http_sd_config
Actually, prometheus do not support Nacos as service discovery directly. Currently, we can only use Prometheus Http SD config for Nacos, see this issue: prometheus/prometheus#7539 . And prometheus don't really care what api path you give, so we can config namespace and service through path variable. Prometheus http sd: https://prometheus.io/docs/prometheus/latest/http_sd/
I don't know much about the prometheus sd protocol. From the documentation, I can only see that target hosts are required to be configured, so I always thought it was a fixed uri. Not sure how to configure the uri. If it is the uri that can be customized, then specifying the namespace and serviceName should be the recommended practice
sry, posted wrong doc, see this: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#http_sd_config
So when users config __meta_url
for each target
, prometheus will call the specifed url replace the fixed one?
Actually, prometheus do not support Nacos as service discovery directly. Currently, we can only use Prometheus Http SD config for Nacos, see this issue: prometheus/prometheus#7539 . And prometheus don't really care what api path you give, so we can config namespace and service through path variable. Prometheus http sd: https://prometheus.io/docs/prometheus/latest/http_sd/
I don't know much about the prometheus sd protocol. From the documentation, I can only see that target hosts are required to be configured, so I always thought it was a fixed uri. Not sure how to configure the uri. If it is the uri that can be customized, then specifying the namespace and serviceName should be the recommended practice
sry, posted wrong doc, see this: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#http_sd_config
So when users config
__meta_url
for eachtarget
, prometheus will call the specifed url replace the fixed one?
I think users should config url
.
I don't found the config url
, can you provide a demo configuration?
What's more, the usage of prometheus sd document is leak. Would you mind try to add the docuement of usage after the issue completed?
I don't found the config
url
, can you provide a demo configuration?What's more, the usage of prometheus sd document is leak. Would you mind try to add the docuement of usage after the issue completed?
Here is a demo
- job_name: 'http_sd_example'
metrics_path: /metrics
scheme: http
http_sd_configs:
- url: https://example.com/targets.json
timeout: 5s
And for document,for sure I will write one.
OK, I understand, I will review the PR and comment in PR some request changes. If no, PR will be merged.
After this, Please help community add an usage document in nacos-group/
PR merged, Please help to submit usage document.
@KomachiSion I will write a document after solving this security issue #10752
This issue only waiting the relative usage document, Any community contributors prefer to contribute?