spring cloud集成zipkin Server:Prometheus requires that all meters with the same name have分析

阿里 阅读:171 2021-03-31 13:18:13 评论:0

spring boot 2.1.0.RELEASE 的版本,整合zipkin2.12.0
zipkin Server服务启动后,访问zipkin Server 的UI:

http://localhost:8087/zipkin/ 

后台提示报错:

java.lang.IllegalArgumentException: Prometheus requires that all meters with the same name have the same set of tag keys. There is already an existing meter containing tag keys [exception, method, outcome, status, uri]. The meter you are attempting to register has keys [method, status, uri]. 
	at io.micrometer.prometheus.PrometheusMeterRegistry.lambda$collectorByName$9(PrometheusMeterRegistry.java:360) ~[micrometer-registry-prometheus-1.1.0.jar:1.1.0] 
	at java.util.concurrent.ConcurrentHashMap.compute(Unknown Source) ~[na:1.8.0_162] 
	at io.micrometer.prometheus.PrometheusMeterRegistry.collectorByName(PrometheusMeterRegistry.java:347) ~[micrometer-registry-prometheus-1.1.0.jar:1.1.0] 
	at io.micrometer.prometheus.PrometheusMeterRegistry.newTimer(PrometheusMeterRegistry.java:164) ~[micrometer-registry-prometheus-1.1.0.jar:1.1.0] 
	at io.micrometer.core.instrument.MeterRegistry.lambda$timer$2(MeterRegistry.java:271) ~[micrometer-core-1.1.0.jar:1.1.0] 
	at io.micrometer.core.instrument.MeterRegistry.getOrCreateMeter(MeterRegistry.java:580) ~[micrometer-core-1.1.0.jar:1.1.0] 
	at io.micrometer.core.instrument.MeterRegistry.registerMeterIfNecessary(MeterRegistry.java:543) ~[micrometer-core-1.1.0.jar:1.1.0] 
	at io.micrometer.core.instrument.MeterRegistry.timer(MeterRegistry.java:269) ~[micrometer-core-1.1.0.jar:1.1.0] 
	at io.micrometer.core.instrument.Timer$Builder.register(Timer.java:464) ~[micrometer-core-1.1.0.jar:1.1.0] 
	at zipkin2.autoconfigure.prometheus.ZipkinPrometheusMetricsAutoConfiguration$HttpRequestDurationHandler.lambda$handleRequest$0(ZipkinPrometheusMetricsAutoConfiguration.java:78) ~[zipkin-autoconfigure-metrics-prometheus-2.12.0.jar:na] 
	at io.undertow.server.HttpServerExchange.invokeExchangeCompleteListeners(HttpServerExchange.java:1276) ~[undertow-core-2.0.14.Final.jar:2.0.14.Final] 
	at io.undertow.server.HttpServerExchange.terminateResponse(HttpServerExchange.java:1563) ~[undertow-core-2.0.14.Final.jar:2.0.14.Final] 
	at io.undertow.server.Connectors.terminateResponse(Connectors.java:143) ~[undertow-core-2.0.14.Final.jar:2.0.14.Final] 
	at io.undertow.server.protocol.http.ServerFixedLengthStreamSinkConduit.channelFinished(ServerFixedLengthStreamSinkConduit.java:58) ~[undertow-core-2.0.14.Final.jar:2.0.14.Final] 
	at io.undertow.conduits.AbstractFixedLengthStreamSinkConduit.exitFlush(AbstractFixedLengthStreamSinkConduit.java:316) ~[undertow-core-2.0.14.Final.jar:2.0.14.Final] 
	at io.undertow.conduits.AbstractFixedLengthStreamSinkConduit.flush(AbstractFixedLengthStreamSinkConduit.java:234) ~[undertow-core-2.0.14.Final.jar:2.0.14.Final] 
	at org.xnio.conduits.ConduitStreamSinkChannel.flush(ConduitStreamSinkChannel.java:162) ~[xnio-api-3.6.5.Final.jar:3.6.5.Final] 
	at io.undertow.channels.DetachableStreamSinkChannel.flush(DetachableStreamSinkChannel.java:119) ~[undertow-core-2.0.14.Final.jar:2.0.14.Final] 
	at org.xnio.channels.Channels.flushBlocking(Channels.java:63) ~[xnio-api-3.6.5.Final.jar:3.6.5.Final] 
	at io.undertow.servlet.spec.ServletOutputStreamImpl.close(ServletOutputStreamImpl.java:618) ~[undertow-servlet-2.0.14.Final.jar:2.0.14.Final] 
	at io.undertow.servlet.spec.HttpServletResponseImpl.closeStreamAndWriter(HttpServletResponseImpl.java:486) ~[undertow-servlet-2.0.14.Final.jar:2.0.14.Final] 
	at io.undertow.servlet.spec.HttpServletResponseImpl.responseDone(HttpServletResponseImpl.java:575) ~[undertow-servlet-2.0.14.Final.jar:2.0.14.Final] 
	at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:346) ~[undertow-servlet-2.0.14.Final.jar:2.0.14.Final] 
	at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81) ~[undertow-servlet-2.0.14.Final.jar:2.0.14.Final] 
	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138) ~[undertow-servlet-2.0.14.Final.jar:2.0.14.Final] 
	at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135) ~[undertow-servlet-2.0.14.Final.jar:2.0.14.Final] 
	at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48) ~[undertow-servlet-2.0.14.Final.jar:2.0.14.Final] 
	at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) ~[undertow-servlet-2.0.14.Final.jar:2.0.14.Final] 
	at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272) ~[undertow-servlet-2.0.14.Final.jar:2.0.14.Final] 
	at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81) ~[undertow-servlet-2.0.14.Final.jar:2.0.14.Final] 
	at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104) ~[undertow-servlet-2.0.14.Final.jar:2.0.14.Final] 
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:360) ~[undertow-core-2.0.14.Final.jar:2.0.14.Final] 
	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830) [undertow-core-2.0.14.Final.jar:2.0.14.Final] 
	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) [jboss-threads-2.3.2.Final.jar:2.3.2.Final] 
	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985) [jboss-threads-2.3.2.Final.jar:2.3.2.Final] 
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487) [jboss-threads-2.3.2.Final.jar:2.3.2.Final] 
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1349) [jboss-threads-2.3.2.Final.jar:2.3.2.Final] 
	at java.lang.Thread.run(Unknown Source) [na:1.8.0_162] 
 
```bash 
在这里插入代码片 

解决方法:

在application.properties中添加如下配置:

#zipkin启动报错无法访问的解决方法 
management.metrics.web.server.auto-time-requests=false 
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

发表评论
搜索
排行榜
关注我们

一个IT知识分享的公众号