我们使用 Spring Boot 2 与 Actuator 和 Prometheus 来显示 Grafana 仪表板。我想添加 Apache Http Client PoolingHttpClientConnectionManager 指标来报告连接池统计信息。我看到它已添加到 micrometer-core:1.3.0 ( https://github.com/micrometer-metrics/micrometer/pull/1223 )。但是,我在 /actuator/metrics 或 /actuator/prometheus 端点中没有看到任何相关指标。我尝试更新 pom.xml 中的依赖项:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
<version>1.4.2</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.4.2</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
应用程序.yml
# Spring Actuator Configuration
management:
endpoint:
health:
show-details: always
endpoints:
web:
exposure:
include: "*"
metrics:
enable:
all: true
Run Code Online (Sandbox Code Playgroud)
/执行器/指标
{
"names": [
"jvm.buffer.memory.used",
"jvm.threads.states",
"tomcat.servlet.error",
"process.uptime", …Run Code Online (Sandbox Code Playgroud)