我正在尝试在Jaeger中获取mongo日志。基本上,我希望我的Jaeger显示我的mongo应用程序错误。最好的方法是什么?
我已经尝试过使用Maven repo- opentracing-mongo-driver(0.1.4版)
在我的代码中,我使用-
@Bean
public Tracer jaegerTracer() {
Tracer tracer = jaegerTracer();
MongoSpanNameProvider customNameProvider;
TracingCommandListener listener = new TracingCommandListener.Builder(tracer).build();
MongoClient mongoClient = MongoClients.create(
MongoClientSettings.builder()
.addCommandListener(listener)
.build());
//MongoClient mongoClient = new TracingMongoClient(tracer, "http://localhost:27017");
//TracingCommandListener listener = new TracingCommandListener.Builder(tracer).build();
return new Configuration("spring-boot", new Configuration.SamplerConfiguration(ProbabilisticSampler.TYPE, 1),
new Configuration.ReporterConfiguration())
.getTracer();
}
但是我收到这个错误-
java.lang.AbstractMethodError: Receiver class io.opentracing.noop.NoopSpanBuilderImpl does not define or inherit an implementation of the resolved method abstract startActive(Z)Lio/opentracing/Scope; of interface io.opentracing.Tracer$SpanBuilder.
at io.opentracing.contrib.web.servlet.filter.TracingFilter.doFilter(TracingFilter.java:156) ~[opentracing-web-servlet-filter-0.1.0.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.22.jar:9.0.22]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.22.jar:9.0.22]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.22.jar:9.0.22]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[tomcat-embed-core-9.0.22.jar:9.0.22]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) ~[tomcat-embed-core-9.0.22.jar:9.0.22]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) ~[tomcat-embed-core-9.0.22.jar:9.0.22]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.22.jar:9.0.22]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-9.0.22.jar:9.0.22]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[tomcat-embed-core-9.0.22.jar:9.0.22]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) ~[tomcat-embed-core-9.0.22.jar:9.0.22]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) ~[tomcat-embed-core-9.0.22.jar:9.0.22]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853) ~[tomcat-embed-core-9.0.22.jar:9.0.22]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587) ~[tomcat-embed-core-9.0.22.jar:9.0.22]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.22.jar:9.0.22]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.22.jar:9.0.22]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
我做错了什么事?
最佳答案
您很可能与OpenTracing库不匹配。您的Servlet过滤器集成(io.opentracing.contrib.web.servlet.filter.TracingFilter)似乎正在使用一种不存在的方法。