【发布时间】:2021-11-30 23:45:45
【问题描述】:
我正在使用 Spring Boot 2.5.4 和带有 Micrometer 和 Prometheus 支持的 Actuator。
当我打开 /actuator/prometheus 端点时,我会看到如下指标:
# HELP jvm_threads_live_threads The current number of live threads including both daemon and non-daemon threads
# TYPE jvm_threads_live_threads gauge
jvm_threads_live_threads 28.0
请注意,该指标没有附加时间戳。但是,根据OpenMetrics / Prometheus spec,可以在指标输出中添加时间戳。
我的问题:如何告诉 Spring Boot Actuator 生成时间戳并将其添加到它创建的指标中?我还没有找到任何关于它的文档。谢谢!
参考文献
我的pom.xml 依赖项如下所示:
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
我的application.yaml 是这样的:
# Application name. Shows up in metrics etc.
spring:
application:
name: "some_app_name"
# Expose application on port 8080
server:
port: ${SERVER_PORT:8080}
# Expose all Actuator endpoints (don't do this in production!)
management:
endpoints:
web:
exposure:
include:
- "*"
【问题讨论】:
标签: spring-boot prometheus spring-boot-actuator