prometheus 服务java服务接入基础镜像配置

环境变量设置:

如果不经常修改配置,推荐在java镜像中把prometheus配置通过环境变量的方式统一配置,可以使用下面的参数,把端口进行暴漏

(配置安全检查端口9998,启用所有安全检查接口,配置普罗米修斯的监测间隔,设置java服务名,把普罗米修斯的接口提升到根目录)

ENV SPRING_APPLICATION_JSON='{"management.server.port":"9998","management.endpoint.health.show-details":"always","management.endpoints.web.exposure.include":"*","management.endpoints.metrics.export.prometheus.enabled":"true","management.endpoint.health.group.liveness.include":"*","management.endpoint.health.group.readiness.include":"*","MANAGEMENT_METRICS_DISTRIBUTION_SLA_HTTP_SERVER_REQUESTS":"5ms,10ms,25ms,50ms,100ms,250ms,500ms,1000ms,2500ms,5s,10s","management.metrics.tags.application":"${spring.application.name}","management.endpoints.web.base-path":"/"}' 

记录下修改actuator接口的修改配置

# 把/actuator/health 接口更换成/actuator/healthcheck

management.endpoints.web.path-mapping.health=healthcheck

# 把/actuator/prometheus接口更换为/actuator/prometheus-check management.endpoints.web.path-mapping.prometheus=prometheus-check

# 只有加这个配置,就会去掉安全检查接口的/actuator层,指向接口例如:上面的health会换成/healthcheck,prometheus检查接口会更换成:curl localhost:9998/prometheus

management.endpoints.web.base-path=/

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值