一、该问题的重现步骤是什么?
添加依赖
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <!-- Micrometer Prometheus 支持 --> <dependency> <groupId>io.micrometer</groupId> <artifactId>micrometer-registry-prometheus</artifactId> </dependency>
2. 添加配置
management:
endpoints:
web:
exposure:
include: "*"
metrics:
tags:
application: ${spring.application.name}3.访问http://127.0.0.1/actuator/prometheus
# HELP http_server_requests_active_seconds
# TYPE http_server_requests_active_seconds summary
http_server_requests_active_seconds_active_count{exception="none",method="GET",outcome="SUCCESS",status="200",uri="UNKNOWN",} 1.0
http_server_requests_active_seconds_duration_sum{exception="none",method="GET",outcome="SUCCESS",status="200",uri="UNKNOWN",} 0.001479042
# HELP http_server_requests_seconds
# TYPE http_server_requests_seconds summary
http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/actuator/prometheus",} 4.0
http_server_requests_seconds_sum{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/actuator/prometheus",} 0.0898985
http_server_requests_seconds_count{error="none",exception="none",method="GET",outcome="SERVER_ERROR",status="500",uri="UNKNOWN",} 8.0
http_server_requests_seconds_sum{error="none",exception="none",method="GET",outcome="SERVER_ERROR",status="500",uri="UNKNOWN",} 0.093134249
# HELP http_server_requests_seconds_max
# TYPE http_server_requests_seconds_max gauge
http_server_requests_seconds_max{error="none",exception="none",method="GET",outcome="SUCCESS",status="200",uri="/actuator/prometheus",} 0.077782875
http_server_requests_seconds_max{error="none",exception="none",method="GET",outcome="SERVER_ERROR",status="500",uri="UNKNOWN",} 0.037080542
# HELP lettuce_command_firstresponse_seconds Latency between command send and first response (first response received)
# TYPE lettuce_command_firstresponse_seconds summary
lettuce_command_firstresponse_seconds_count{command="SETEX",local="local:any",remote="/139.9.205.253:6379",} 1.0
lettuce_command_firstresponse_seconds_sum{command="SETEX",local="local:any",remote="/139.9.205.253:6379",} 0.0244355
lettuce_command_firstresponse_seconds_count{command="SELECT",local="local:any",remote="/139.9.205.253:6379",} 2.0
lettuce_command_firstresponse_seconds_sum{command="SELECT",local="local:any",remote="/139.9.205.253:6379",} 0.055978333
lettuce_command_firstresponse_seconds_count{command="GET",local="local:any",remote="/139.9.205.253:6379",} 2.0
lettuce_command_firstresponse_seconds_sum{command="GET",local="local:any",remote="/139.9.205.253:6379",} 0.051359167
lettuce_command_firstresponse_seconds_count{command="DEL",local="local:any",remote="/139.9.205.253:6379",} 1.0
lettuce_command_firstresponse_seconds_sum{command="DEL",local="local:any",remote="/139.9.205.253:6379",} 0.024760833
lettuce_command_firstresponse_seconds_count{command="EXISTS",local="local:any",remote="/139.9.205.253:6379",} 1.0
lettuce_command_firstresponse_seconds_sum{command="EXISTS",local="local:any",remote="/139.9.205.253:6379",} 0.028612583
lettuce_command_firstresponse_seconds_count{command="INFO",local="local:any",remote="/139.9.205.253:6379",} 1.0
lettuce_command_firstresponse_seconds_sum{command="INFO",local="local:any",remote="/139.9.205.253:6379",} 0.0310525
lettuce_command_firstresponse_seconds_count{command="PEXPIRE",local="local:any",remote="/139.9.205.253:6379",} 1.0
lettuce_command_firstresponse_seconds_sum{command="PEXPIRE",local="local:any",remote="/139.9.205.253:6379",} 0.025246
lettuce_command_firstresponse_seconds_count{command="HELLO",local="local:any",remote="/139.9.205.253:6379",} 2.0
lettuce_command_firstresponse_seconds_sum{command="HELLO",local="local:any",remote="/139.9.205.253:6379",} 0.058583083
lettuce_command_firstresponse_seconds_count{command="SET",local="local:any",remote="/139.9.205.253:6379",} 1.0
lettuce_command_firstresponse_seconds_sum{command="SET",local="local:any",remote="/139.9.205.253:6379",} 0.025612625
# HELP lettuce_command_firstresponse_seconds_max Latency between command send and first response (first response received)
# TYPE lettuce_command_firstresponse_seconds_max gauge
lettuce_command_firstresponse_seconds_max{command="SETEX",local="local:any",remote="/139.9.205.253:6379",} 0.0244355
lettuce_command_firstresponse_seconds_max{command="SELECT",local="local:any",remote="/139.9.205.253:6379",} 0.030763
lettuce_command_firstresponse_seconds_max{command="GET",local="local:any",remote="/139.9.205.253:6379",} 0.026595708
lettuce_command_firstresponse_seconds_max{command="DEL",local="local:any",remote="/139.9.205.253:6379",} 0.024760833二、你期待的结果是什么?实际看到的又是什么?每个数据都会携带application
第一个结果要tags标签要生效
第二个现在的监控数据缺失JVM的内存信息。监控信息少了很多、也不正常。

三、你正在使用的是什么产品,什么版本?在什么操作系统上?
boot4.6.0 mac系统
四、请提供详细的错误堆栈信息,这很重要。
五、若有更多详细信息,请在下面提供。
扫一扫访问 Blade技术社区 移动端