一段时间以来,我一直在挠头。我的错误在我的JSON后面的端点中传播。
对于每个请求,原始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"}
我有一个springboot应用程序设置,用于用prometheus进行监视...我在另一个项目中使用了此模板,但它没有给我带来任何问题。我不确定发生了什么变化。
老实说,我不知道该怎么做才能调试这类东西...
这是部分堆栈跟踪(很长,可以根据要求包含整个内容)。
[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)
这些是我的依赖项:
<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>
答案 0 :(得分:0)
我不知道这是怎么改变的,但是我注意到我的配套服务使用的是spring.2.boot-starter-actuator的2.0.2.RELEASE和micrometer-registry-prometheus的1.0.4。
我更改了pom使其与这些版本匹配,该问题消失了。
虚惊一场,对不起!