在 Spring Boot 3.x 中使用 Prometheus 时,某些 Tomcat 指标不可见

问题描述 投票:0回答:1
  • Spring Boot 版本:
    3.3.2
  • 依赖性
    • io.micrometer:micrometer-core
      (最新)
    • io.micrometer:micrometer-registry-prometheus
      (最新)

某些 Tomcat 指标不可见。 输出的指标。

  • tomcat.sessions.active.current
  • tomcat.sessions.active.max
  • tomcat.sessions.alive.max
  • tomcat.sessions.created
  • tomcat.sessions.expired
  • tomcat.sessions.rejected

未打印的指标

  • tomcat.global.request.max
  • tomcat.global.request.count
  • tomcat.threads.config.max
  • tomcat.threads.current
  • tomcat.threads.busy
  • tomcat.connections.max
  • tomcat.connections.current
  • tomcat.connections.keepalive.current
  • tomcat.servlet.request.max
  • tomcat.servlet.request.count
  • tomcat.servlet.request.total-time

这是application.yaml

spring:
  application:
    name: myapplicationname
management:
  server:
    port: 9123
  endpoints:
    web:
      exposure:
        include: "*"
      base-path: /actuator
  endpoint:
    metrics:
      enabled: true
    health:
      enabled: true
      probes:
        enabled: true
  health:
    livenessstate:
      enabled: true
    readinessstate:
      enabled: true
  metrics:
    enable:
      tomcat: true
    tags:
      application: 'myapplicationnameee'
    distribution:
      percentiles-histogram:
        tomcat:
          request: true
        reactor:
          onNext:
            delay: true
    export:
      prometheus:
        pushgateway:
          enabled: true
          push-rate: 1s
server:
  port: 98765
  shutdown: graceful
spring-boot prometheus spring-boot-actuator
1个回答
0
投票

这些指标是从 Tomcat MBean 读取的。使用 server.tomcat.mbeanregistry.enabled=true 属性

© www.soinside.com 2019 - 2024. All rights reserved.