我在 spring application.properties 中使用 Zipkin 库对客户端应用程序进行了配置。
camel.zipkin.host-name=hawkular-apm-server.com
camel.zipkin.port=443
camel.zipkin.include-message-body-streams=true
Maven依赖
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-zipkin-starter</artifactId>
</dependency>
可以从本地机器访问 hawkular apm 服务器控制台。
但是,当调用客户端应用程序中公开的其余 api 时,会记录 zipkin 跟踪但它们不会在 hawkular apm 服务器上收集。
04:31:55.632 [http-nio-0.0.0.0-8080-exec-1] INFO o.a.c.c.s.CamelHttpTransportServlet - Initialized CamelHttpTransportServlet[name=CamelServlet, contextPath=]
04:31:55.668 [http-nio-0.0.0.0-8080-exec-1] DEBUG org.apache.camel.zipkin.ZipkinTracer - clientRequest [service=MyCamelClient, traceId=-5541987202080201726, spanId=-5541987202080201726]
04:31:55.672 [http-nio-0.0.0.0-8080-exec-1] DEBUG org.apache.camel.zipkin.ZipkinTracer - serverRequest [service=MyCamel, traceId=-5541987202080201726, spanId=-5541987202080201726]
04:31:55.676 [http-nio-0.0.0.0-8080-exec-1] DEBUG org.apache.camel.zipkin.ZipkinTracer - serverResponse[service=MyCamel, traceId=-5541987202080201726, spanId=-5541987202080201726]
04:31:55.677 [http-nio-0.0.0.0-8080-exec-1] DEBUG org.apache.camel.zipkin.ZipkinTracer - clientResponse[service=MyCamelClient, traceId=-5541987202080201726, spanId=-5541987202080201726]
04:31:55.758 [pool-1-thread-1] WARN o.a.t.transport.TIOStreamTransport - Error closing output stream.
java.net.SocketException: Socket closed
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:118)
at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at java.io.FilterOutputStream.close(FilterOutputStream.java:158)
at org.apache.thrift.transport.TIOStreamTransport.close(TIOStreamTransport.java:110)
at org.apache.thrift.transport.TSocket.close(TSocket.java:194)
at org.apache.thrift.transport.TFramedTransport.close(TFramedTransport.java:89)
at com.github.kristofa.brave.scribe.ScribeClientProvider.close(ScribeClientProvider.java:96)
at com.github.kristofa.brave.scribe.ScribeClientProvider.exception(ScribeClientProvider.java:75)
at com.github.kristofa.brave.scribe.SpanProcessingThread.log(SpanProcessingThread.java:123)
at com.github.kristofa.brave.scribe.SpanProcessingThread.log(SpanProcessingThread.java:109)
at com.github.kristofa.brave.scribe.SpanProcessingThread.call(SpanProcessingThread.java:95)
at com.github.kristofa.brave.scribe.SpanProcessingThread.call(SpanProcessingThread.java:35)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
04:31:55.763 [pool-1-thread-1] WARN c.g.k.b.scribe.SpanProcessingThread - Logging spans failed. 1 spans are lost!
org.apache.thrift.transport.TTransportException: null
at org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:132)
at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)
at org.apache.thrift.transport.TFramedTransport.readFrame(TFramedTransport.java:129)
at org.apache.thrift.transport.TFramedTransport.read(TFramedTransport.java:101)
at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)
at org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:378)
at org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:297)
at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:204)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:69)
at com.twitter.zipkin.gen.scribe$Client.recv_Log(scribe.java:74)
at com.twitter.zipkin.gen.scribe$Client.Log(scribe.java:61)
at com.github.kristofa.brave.scribe.SpanProcessingThread.log(SpanProcessingThread.java:127)
at com.github.kristofa.brave.scribe.SpanProcessingThread.log(SpanProcessingThread.java:109)
at com.github.kristofa.brave.scribe.SpanProcessingThread.call(SpanProcessingThread.java:95)
at com.github.kristofa.brave.scribe.SpanProcessingThread.call(SpanProcessingThread.java:35)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
我不确定这是否是客户端应用程序的配置问题,因为 Hawkular APM UI 正在正确打开。
据我了解,Zipkin 客户端可以通过简单地替换 hawkular url 代替 zipkin 服务器来与 Hawkular apm 集成,但这似乎不起作用。
对此有任何建议,不幸的是我也找不到任何示例。