chen-gliu/nacos-consul-adapter

定义监控端口management.server.port,prometheus监控会报错

Closed this issue · 3 comments

如果指定了management.server.port=xxxx端口,与gateway端口不一样。
在启动prometheus时会报错,status->targets也看不到(http://172.0.0.1:xxxx/actuator/prometheus),但是直接访问actuator/prometheus时没问题的。

bootstrap.yml配置
management:
metrics:
export:
prometheus:
enabled: true
jmx:
enabled: true
endpoints:
web:
exposure:
include: '*'
server:
port: xxxx

prometheus.yml配置
scrape_configs:
- job_name: 'consul-prometheus-test'
metrics_path: '/actuator/prometheus'
consul_sd_configs:
- server: '172.0.0.1:xxxx'

@weixiaohui-1 有结论了吗

这个项目返回的是你注册到nacos里面的信息,然后Prometheus的consul插件会根据这些信息去请求metric,如果不一致肯定是请求不到的。
如果你想做到不一致,但是Prometheus仍然可以访问到metric可以自己在获取nacos服务实例的接口返回时做一次端口替换。

“获取nacos服务实例的接口返回时做一次端口替换” 如何替换?请教一下