Home > Enterprise >  spring boot 2.7.0 doesn't expose http.server.request metrics
spring boot 2.7.0 doesn't expose http.server.request metrics

Time:07-26

I'm using Spring boot 2.7.0 and I'm trying to expose the http.server.request metrics so I can scrape it in Prometheus but it's not working. My application.yml properties look like this:

management:
    endpoint:
        health:
            probes:
                enabled: true
            show-details: always
    endpoints:
        web:
            exposure:
                include: '*'

    health:
        livenessState:
            enabled: true
        readinessState:
            enabled: true
    metrics:
        tags:
            application: ${spring.application.name}
        distribution:
            percentiles-histogram:
                http:
                    server:
                        requests: true

And I have the following dependencies:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-registry-prometheus</artifactId>
    <scope>runtime</scope>
</dependency>

but in /actuator/metrics endpoint I can't see anything about http.server.request metrics.

{
  "names": [
    "application.ready.time",
    "application.started.time",
    "disk.free",
    "disk.total",
    "executor.active",
    "executor.completed",
    "executor.pool.core",
    "executor.pool.max",
    "executor.pool.size",
    "executor.queue.remaining",
    "executor.queued",
    "hikaricp.connections",
    "hikaricp.connections.acquire",
    "hikaricp.connections.active",
    "hikaricp.connections.creation",
    "hikaricp.connections.idle",
    "hikaricp.connections.max",
    "hikaricp.connections.min",
    "hikaricp.connections.pending",
    "hikaricp.connections.timeout",
    "hikaricp.connections.usage",
    "jdbc.connections.active",
    "jdbc.connections.idle",
    "jdbc.connections.max",
    "jdbc.connections.min",
    "jvm.buffer.count",
    "jvm.buffer.memory.used",
    "jvm.buffer.total.capacity",
    "jvm.classes.loaded",
    "jvm.classes.unloaded",
    "jvm.gc.live.data.size",
    "jvm.gc.max.data.size",
    "jvm.gc.memory.allocated",
    "jvm.gc.memory.promoted",
    "jvm.gc.overhead",
    "jvm.gc.pause",
    "jvm.memory.committed",
    "jvm.memory.max",
    "jvm.memory.usage.after.gc",
    "jvm.memory.used",
    "jvm.threads.daemon",
    "jvm.threads.live",
    "jvm.threads.peak",
    "jvm.threads.states",
    "logback.events",
    "process.cpu.usage",
    "process.start.time",
    "process.uptime",
    "resilience4j.circuitbreaker.buffered.calls",
    "resilience4j.circuitbreaker.calls",
    "resilience4j.circuitbreaker.failure.rate",
    "resilience4j.circuitbreaker.not.permitted.calls",
    "resilience4j.circuitbreaker.slow.call.rate",
    "resilience4j.circuitbreaker.slow.calls",
    "resilience4j.circuitbreaker.state",
    "system.cpu.count",
    "system.cpu.usage",
    "tomcat.sessions.active.current",
    "tomcat.sessions.active.max",
    "tomcat.sessions.alive.max",
    "tomcat.sessions.created",
    "tomcat.sessions.expired",
    "tomcat.sessions.rejected"
  ]
}

My teammates were able to fix this problem by downgrading the spring boot version to 2.3.7.release but I'm not very fond of that. Is there any other way to expose these metrics?

CodePudding user response:

It's an issue with the 2.7.0 spring boot version. Upgrade to 2.7.1

  • Related