简体   繁体   English

(弹簧,千分尺+普罗米修斯)NoSuchMethodError-AbstractTimer。 <init>

[英](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. 我遇到了从JSON后面的端点溢出的错误。

Raw JSON comes out with this message at the end of it for every request: 对于每个请求,原始JSON都会在此消息的末尾显示:

[{"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. 我有一个springboot应用程序设置,用于用prometheus进行监视...我在另一个项目中使用了此模板,它没有给我任何问题。 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 oaccC[.[.[.[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>

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. 我不知道这是如何改变的,但是我注意到我的配套服务使用的是spring.2.boot-starter-actuator的2.0.2.RELEASE和micrometer-registry-prometheus的1.0.4。

I changed my pom to match those versions and the issue vanished. 我更改了pom以使其与这些版本匹配,该问题消失了。

False alarm, sorry! 错误的警报,对不起!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM