Spring Boot Sping Boot 3缺少jvm指标通用标记

u4dcyp6a  于 5个月前  发布在  Spring
关注(0)|答案(1)|浏览(106)

在Sping Boot 2到3迁移之后,我注意到服务从grafana dashboard中消失了。经过短暂的调查,发现在Sping Boot 3中,通用标记不适用于JVM指标。在Sping Boot 2中,application.yaml是这样的

management:
  metrics:
    tags:
      application: demo2

字符串
并制作了像这样的普罗米修斯指标

# HELP jvm_memory_used_bytes The amount of used memory
# TYPE jvm_memory_used_bytes gauge
jvm_memory_used_bytes{application="demo2",area="nonheap",id="Compressed Class Space",} 4668760.0
jvm_memory_used_bytes{application="demo2",area="heap",id="G1 Eden Space",} 0.0
jvm_memory_used_bytes{application="demo2",area="heap",id="G1 Old Gen",} 1.4173592E7
jvm_memory_used_bytes{application="demo2",area="nonheap",id="Metaspace",} 3.400088E7
jvm_memory_used_bytes{application="demo2",area="heap",id="G1 Survivor Space",} 4822464.0
jvm_memory_used_bytes{application="demo2",area="nonheap",id="CodeCache",} 8376192.0


在spring Boot 3 application中,yaml是这样迁移的

management:
  observations:
    key-values:
      application: demo3


并产生了普罗米修斯指标是这些(没有“应用程序”标签)

# HELP jvm_memory_used_bytes The amount of used memory
# TYPE jvm_memory_used_bytes gauge
jvm_memory_used_bytes{area="heap",id="G1 Survivor Space",} 3707904.0
jvm_memory_used_bytes{area="heap",id="G1 Old Gen",} 1.48822E7
jvm_memory_used_bytes{area="nonheap",id="Metaspace",} 3.4899392E7
jvm_memory_used_bytes{area="nonheap",id="CodeCache",} 8664704.0
jvm_memory_used_bytes{area="heap",id="G1 Eden Space",} 2.5165824E7
jvm_memory_used_bytes{area="nonheap",id="Compressed Class Space",} 4869608.0


有什么想法,我忽略了迁移?

xtfmy6hx

xtfmy6hx1#

Spring上似乎有一个问题:https://github.com/spring-projects/spring-boot/issues/38583
这里复制:https://github.com/sbernardo/spring-issues-examples与spring-boot 3.2.0和java 21。
注意:使用已弃用的键management.metrics.tags.application=${spring.application.name}标记“application”出现

更新:

Spring更新了这个问题,并通过以下评论关闭了它:
我们决定现在不对management.metrics.tags进行预处理,我们将在下一个版本中重新考虑整个标记(和键值)的情况。
在Spring-Boot 3.2.1中,可能会恢复旧的行为。

相关问题