2
votes

I am trying to expose timing metrics to prometheus from an api implemented with spring boot 2. I've included 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>
    </dependency>

I'm managing dependencies through spring-cloud-starter-parent Finchley.SR1, which gives me versions of 2.0.4.RELEASE on spring-boot-starter-actuator, and 1.0.6 on micrometer-registry-prometheus.

The /actuator/prometheus endpoint is working and reachable, but the metrics I need are not included. When I look at /acutator/metrics, the "http.server.requests" metric is not listed there:

{
    "names": [
        "jvm.memory.max",
        "cache.eviction.weight",
        "cache.gets",
        "process.files.max",
        "jvm.gc.memory.promoted",
        "tomcat.cache.hit",
        "system.load.average.1m",
        "tomcat.cache.access",
        "jvm.memory.used",
        "jvm.gc.max.data.size",
        "jvm.gc.pause",
        "jvm.memory.committed",
        "system.cpu.count",
        "logback.events",
        "tomcat.global.sent",
        "jvm.buffer.memory.used",
        "tomcat.sessions.created",
        "jvm.threads.daemon",
        "system.cpu.usage",
        "jvm.gc.memory.allocated",
        "tomcat.global.request.max",
        "tomcat.global.request",
        "tomcat.sessions.expired",
        "jvm.threads.live",
        "jvm.threads.peak",
        "tomcat.global.received",
        "process.uptime",
        "cache.puts",
        "cache.size",
        "cache.evictions",
        "tomcat.sessions.rejected",
        "process.cpu.usage",
        "tomcat.threads.config.max",
        "jvm.classes.loaded",
        "jvm.classes.unloaded",
        "tomcat.global.error",
        "tomcat.sessions.active.current",
        "tomcat.sessions.alive.max",
        "jvm.gc.live.data.size",
        "tomcat.servlet.request.max",
        "tomcat.threads.current",
        "tomcat.servlet.request",
        "process.files.open",
        "jvm.buffer.count",
        "jvm.buffer.total.capacity",
        "tomcat.sessions.active.max",
        "tomcat.threads.busy",
        "process.start.time",
        "tomcat.servlet.error"
    ]
}

According to documentation, and everything I can find searching google, it should be one of the metrics that is autoconfigured out-of-the-box.

I have tried this with the spring.metrics.web.server.auto-time-requests property set to true, and with @Timed annotations on the endpoint I am testing with, and either way I get nothing.

I found this resolved issue in which someone had the same symptoms, but they were using spring boot 1.5 and their issue was an unneeded extra dependency that I do not have:

Actuator /metrics endpoint does not include http.server.requests

Any idea what would cause actuator to not expose the http.server.requests metric?

I should add that I have 6 other services like this one in which the metrics are working as expected, so it's just this one out of the 7 where it does not work. I can't figure out what is different about this one. I've even tried stripping it down to remove any dependencies that are not also present in the other six, but still this one won't report that metric.

1

1 Answers

2
votes

Can you after accessing any one of your end-point? Just give it a try from postman or from your app and check the /metrics endpoint. I hope it should be there.