如何在 Spring Boot 2x Actuator 中启用 Spring MVC 指标
How to enable Spring MVC metrics in Spring Boot 2x Actuator
我正在尝试在 Spring Boot 2 RESTful 应用程序中设置执行器指标,但是 - 下面支持的指标列表不包括
http.server.requests
公制,
这是 Spring MVC 指标的一部分,如 https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#production-ready-metrics-spring-mvc
中所述
以下是返回的可用指标:
{
"names": [
"jvm.threads.states",
"jvm.memory.used",
"jvm.gc.memory.promoted",
"jvm.memory.max",
"jvm.gc.max.data.size",
"jvm.memory.committed",
"system.cpu.count",
"logback.events",
"tomcat.global.sent",
"jvm.buffer.memory.used",
"tomcat.sessions.created",
"jvm.threads.daemon",
"system.cpu.usage",
"jvm.gc.memory.allocated",
"tomcat.global.request.max",
"tomcat.global.request",
"tomcat.sessions.expired",
"jvm.threads.live",
"jvm.threads.peak",
"tomcat.global.received",
"process.uptime",
"tomcat.sessions.rejected",
"process.cpu.usage",
"tomcat.threads.config.max",
"jvm.classes.loaded",
"jvm.classes.unloaded",
"tomcat.global.error",
"tomcat.sessions.active.current",
"tomcat.sessions.alive.max",
"jvm.gc.live.data.size",
"tomcat.threads.current",
"jvm.gc.pause",
"jvm.buffer.count",
"jvm.buffer.total.capacity",
"tomcat.sessions.active.max",
"tomcat.threads.busy",
"process.start.time"
]
}
我已经包含了以下依赖项(其中包括):
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
...
有没有办法在我的 Spring Boot 2 应用程序中包含 http.server.requests
指标?
事实证明 - 您需要对应用程序本身执行至少一个 http 请求 - 不包括管理端点。
只需在应用程序中使用浏览器点击任何 url,就会导致 http.server.requests
出现在指标列表中。
我正在尝试在 Spring Boot 2 RESTful 应用程序中设置执行器指标,但是 - 下面支持的指标列表不包括
http.server.requests
公制,
这是 Spring MVC 指标的一部分,如 https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#production-ready-metrics-spring-mvc
中所述以下是返回的可用指标:
{
"names": [
"jvm.threads.states",
"jvm.memory.used",
"jvm.gc.memory.promoted",
"jvm.memory.max",
"jvm.gc.max.data.size",
"jvm.memory.committed",
"system.cpu.count",
"logback.events",
"tomcat.global.sent",
"jvm.buffer.memory.used",
"tomcat.sessions.created",
"jvm.threads.daemon",
"system.cpu.usage",
"jvm.gc.memory.allocated",
"tomcat.global.request.max",
"tomcat.global.request",
"tomcat.sessions.expired",
"jvm.threads.live",
"jvm.threads.peak",
"tomcat.global.received",
"process.uptime",
"tomcat.sessions.rejected",
"process.cpu.usage",
"tomcat.threads.config.max",
"jvm.classes.loaded",
"jvm.classes.unloaded",
"tomcat.global.error",
"tomcat.sessions.active.current",
"tomcat.sessions.alive.max",
"jvm.gc.live.data.size",
"tomcat.threads.current",
"jvm.gc.pause",
"jvm.buffer.count",
"jvm.buffer.total.capacity",
"tomcat.sessions.active.max",
"tomcat.threads.busy",
"process.start.time"
]
}
我已经包含了以下依赖项(其中包括):
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
...
有没有办法在我的 Spring Boot 2 应用程序中包含 http.server.requests
指标?
事实证明 - 您需要对应用程序本身执行至少一个 http 请求 - 不包括管理端点。
只需在应用程序中使用浏览器点击任何 url,就会导致 http.server.requests
出现在指标列表中。