我有一个使用千分尺的Pushgateway的Spring应用程序,主要基于本教程:https://luramarchanjo.tech/2020/01/05/spring-boot-2.2-and-prometheus-pushgateway-with-micrometer.html
pom.xml有以下相关的依赖关系:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_pushgateway</artifactId>
<version>0.16.0</version>
</dependency>application.properties文件有:
management.metrics.export.prometheus.pushgateway.enabled=false
management.metrics.export.prometheus.pushgateway.shutdown-operation=PUSH
management.metrics.export.prometheus.pushgateway.baseUrl=localhost:9091在Dev环境中,它在没有任何身份验证的情况下连接到Pushgateway时,在本地运行良好。在我们的CI环境中,Prometheus Pushgateway已经启用了基本功能。如何在这个Spring引导应用程序中配置基本的auth凭据?
发布于 2022-08-29 21:10:13
看来弹簧启动的自动配置和Prometheus的PushGateway都不支持直接提供凭据。
我想你可以做两件事:
PrometheusPushGatewayManager bean,并在将PushGateway传递给PrometheusPushGatewayManager的ctor之前,使用具有creds的工厂在PushGateway实例上调用PushGateway。https://stackoverflow.com/questions/73503973
复制相似问题