Kongmingtwo
Kongmingtwo

Reputation: 105

(spring, micrometer+prometheus) NoSuchMethodError - AbstractTimer.<init>

I've been scratching my head on this one for a while. I have this error that's trickling out of my endpoint behind my JSON.

Raw JSON comes out with this message at the end of it for every request:

[{"xd":"0"}]{"error":"OK","message":"io.micrometer.core.instrument.AbstractTimer.<init>(Lio/micrometer/core/instrument/Meter$Id;Lio/micrometer/core/instrument/Clock;Lio/micrometer/core/instrument/distribution/DistributionStatisticConfig;Lio/micrometer/core/instrument/distribution/pause/PauseDetector;Ljava/util/concurrent/TimeUnit;Z)V","path":"/avgSpeed","status":200,"timestamp":"2018-06-21T16:40:31.639+0000"}

I have a springboot app setup for monitoring with prometheus... I used this template on another project and it's not giving me any problems. I'm not sure what changed.

I honestly don't know what to do to debug this type of thing...

Here's a partial stack trace (it's very long, can include the whole thing on request). [http-nio-8080-exec-2] default 2018-06-21 12:40:31,634 ERROR o.a.c.c.C.[.[.[.[dispatcherServlet]:182 - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Filter execution threw an exception] with root cause java.lang.NoSuchMethodError: io.micrometer.core.instrument.AbstractTimer.(Lio/micrometer/core/instrument/Meter$Id;Lio/micrometer/core/instrument/Clock;Lio/micrometer/core/instrument/distribution/DistributionStatisticConfig;Lio/micrometer/core/instrument/distribution/pause/PauseDetector;Ljava/util/concurrent/TimeUnit;Z)V at io.micrometer.prometheus.PrometheusTimer.(PrometheusTimer.java:40) at io.micrometer.prometheus.PrometheusMeterRegistry.newTimer(PrometheusMeterRegistry.java:161) at io.micrometer.core.instrument.MeterRegistry.lambda$timer$2(MeterRegistry.java:255) at io.micrometer.core.instrument.MeterRegistry.getOrCreateMeter(MeterRegistry.java:561) at io.micrometer.core.instrument.MeterRegistry.registerMeterIfNecessary(MeterRegistry.java:537) at io.micrometer.core.instrument.MeterRegistry.timer(MeterRegistry.java:253) at io.micrometer.core.instrument.Timer$Builder.register(Timer.java:420) at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.stop(WebMvcMetricsFilter.java:237) at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.record(WebMvcMetricsFilter.java:228) at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:166) at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:126) at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:111) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

These are my dependencies:

<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>2.0.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <version>2.0.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <version>2.0.0.RELEASE</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
            <version>2.0.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.2.2</version>
        </dependency>
        <!-- json utilities -->
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1.1</version>
        </dependency>
        <!-- for exposing endpoints / prometheus+grafana container -->
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-prometheus</artifactId>
            <version>1.0.5</version>
        </dependency>
        <!-- for logback evaluator -->
        <dependency>
            <groupId>org.codehaus.janino</groupId>
            <artifactId>janino</artifactId>
            <version>3.0.8</version>
        </dependency>
    </dependencies>

Upvotes: 0

Views: 6949

Answers (1)

Kongmingtwo
Kongmingtwo

Reputation: 105

I don't know how this got changed, but I noticed my companion service was using 2.0.2.RELEASE for spring-boot-starter-actuator and 1.0.4 for micrometer-registry-prometheus.

I changed my pom to match those versions and the issue vanished.

False alarm, sorry!

Upvotes: 1

Related Questions