您希望有人可以帮助我尝试获得zipkin的基本实现,以便掌握分布式跟踪。我使用弹簧靴来做到这一点,但似乎无法让它工作。当我尝试查找我的服务的跟踪时,zipkin UI中没有任何内容。
我有两个部署如下:
我想要登录的春季启动应用程序:
的pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>zipkinClient</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>zipkinClient</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Dalston.RELEASE</spring-cloud.version>
</properties>
<dependencies>
<!-- If i only put this dependency in then my app does not start -->
<!-- dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
有了这些依赖项,我会因为Rabbit mq依赖而出现连接错误。我不得不包括这个因为我得到了META-INF /弹簧粘合剂错误。除了把依赖关系放进去之外,我真的不确定如何解决这个问题。
我的application.class
package com.example.demo;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.sleuth.sampler.AlwaysSampler;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
@SpringBootApplication
@RestController
public class ZipkinApplication {
private static final Logger LOG = Logger.getLogger(ZipkinApplication.class.getName());
@Autowired
private RestTemplate restTemplate;
public static void main(String[] args) {
SpringApplication.run(ZipkinApplication.class, args);
}
@Bean
public RestTemplate getRestTemplate() {
return new RestTemplate();
}
@Bean
public AlwaysSampler defaultSampler() {
return new AlwaysSampler();
}
@RequestMapping("/zipkin")
public String home() {
LOG.log(Level.INFO, "you called home");
return "Hello World";
}
@RequestMapping("/callhome")
public String callHome() {
LOG.log(Level.INFO, "calling home");
return restTemplate.getForObject("http://localhost:8080/zipkin", String.class);
}
}
当我运行此应用程序并调用我的端点时,我可以看到它应该将其发送到zipkin的日志记录。
2017-05-17 15:20:09.425 INFO [zipkin demo,13ad9334863d28cf,13ad9334863d28cf,true] 23980 --- [nio-8080-exec-1] com.example.demo.ZipkinApplication : calling home
2017-05-17 15:20:09.550 INFO [zipkin demo,13ad9334863d28cf,a637530dc2dc2852,true] 23980 --- [nio-8080-exec-5] com.example.demo.ZipkinApplication : you called home
这是我的完整日志。我再次获得了rabbitmq异常,但不确定为什么我真的需要这个。没有它就可以拉链拉链
我的完整日志:
2017-05-17 15:19:45.162 INFO [zipkin demo,,,] 23980 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'rabbitConnectionFactory': registering with JMX server as MBean [org.springframework.amqp.rabbit.connection:name=rabbitConnectionFactory,type=CachingConnectionFactory]
2017-05-17 15:19:45.172 INFO [zipkin demo,,,] 23980 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'refreshEndpoint': registering with JMX server as MBean [org.springframework.cloud.endpoint:name=refreshEndpoint,type=RefreshEndpoint]
2017-05-17 15:19:45.183 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering beans for JMX exposure on startup
2017-05-17 15:19:45.184 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel errorChannel
2017-05-17 15:19:45.189 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageChannel,name=errorChannel': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=errorChannel]
2017-05-17 15:19:45.283 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel nullChannel
2017-05-17 15:19:45.285 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageChannel,name=nullChannel': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=nullChannel]
2017-05-17 15:19:45.303 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel sleuth
2017-05-17 15:19:45.305 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageChannel,name=sleuth': registering with JMX server as MBean [org.springframework.integration:type=MessageChannel,name=sleuth]
2017-05-17 15:19:45.336 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageHandler errorLogger
2017-05-17 15:19:45.338 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageHandler,name=errorLogger,bean=internal': registering with JMX server as MBean [org.springframework.integration:type=MessageHandler,name=errorLogger,bean=internal]
2017-05-17 15:19:45.373 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageSource sleuthStreamSpanReporter.poll.inboundChannelAdapter
2017-05-17 15:19:45.375 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Located managed bean 'org.springframework.integration:type=MessageSource,name=sleuthStreamSpanReporter.poll.inboundChannelAdapter,bean=endpoint': registering with JMX server as MBean [org.springframework.integration:type=MessageSource,name=sleuthStreamSpanReporter.poll.inboundChannelAdapter,bean=endpoint]
2017-05-17 15:19:45.698 INFO [zipkin demo,,,] 23980 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase -2147482648
2017-05-17 15:19:46.060 INFO [zipkin demo,,,] 23980 --- [ main] com.example.demo.ZipkinApplication : No active profile set, falling back to default profiles: default
2017-05-17 15:19:46.068 INFO [zipkin demo,,,] 23980 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@28941a68: startup date [Wed May 17 15:19:46 BST 2017]; parent: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2dcd168a
2017-05-17 15:19:46.248 INFO [zipkin demo,,,] 23980 --- [ main] o.s.c.support.GenericApplicationContext : Refreshing org.springframework.context.support.GenericApplicationContext@5f1db390: startup date [Wed May 17 15:19:46 BST 2017]; root of context hierarchy
2017-05-17 15:19:46.351 INFO [zipkin demo,,,] 23980 --- [ main] com.example.demo.ZipkinApplication : Started ZipkinApplication in 0.575 seconds (JVM running for 27.035)
2017-05-17 15:19:48.498 WARN [zipkin demo,,,] 23980 --- [ main] o.s.amqp.rabbit.core.RabbitAdmin : Failed to declare exchange: Exchange [name=sleuth, type=topic, durable=true, autoDelete=false, internal=false, arguments={}], continuing... org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect
2017-05-17 15:19:48.528 INFO [zipkin demo,,,] 23980 --- [ main] o.s.integration.channel.DirectChannel : Channel 'zipkin demo.sleuth' has 1 subscriber(s).
2017-05-17 15:19:48.529 INFO [zipkin demo,,,] 23980 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2017-05-17 15:19:48.610 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.endpoint.EventDrivenConsumer : Adding {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
2017-05-17 15:19:48.611 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.channel.PublishSubscribeChannel : Channel 'zipkin demo.errorChannel' has 1 subscriber(s).
2017-05-17 15:19:48.611 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.endpoint.EventDrivenConsumer : started _org.springframework.integration.errorLogger
2017-05-17 15:19:48.645 INFO [zipkin demo,,,] 23980 --- [ main] o.s.i.e.SourcePollingChannelAdapter : started sleuthStreamSpanReporter.poll.inboundChannelAdapter
2017-05-17 15:19:48.646 INFO [zipkin demo,,,] 23980 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147482647
2017-05-17 15:19:48.646 INFO [zipkin demo,,,] 23980 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647
2017-05-17 15:19:48.786 INFO [zipkin demo,,,] 23980 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2017-05-17 15:19:48.793 INFO [zipkin demo,,,] 23980 --- [ main] com.example.demo.ZipkinApplication : Started ZipkinApplication in 28.094 seconds (JVM running for 29.477)
2017-05-17 15:20:09.056 INFO [zipkin demo,,,] 23980 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2017-05-17 15:20:09.057 INFO [zipkin demo,,,] 23980 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2017-05-17 15:20:09.308 INFO [zipkin demo,,,] 23980 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 250 ms
2017-05-17 15:20:09.425 INFO [zipkin demo,13ad9334863d28cf,13ad9334863d28cf,true] 23980 --- [nio-8080-exec-1] com.example.demo.ZipkinApplication : calling home
2017-05-17 15:20:09.550 INFO [zipkin demo,13ad9334863d28cf,a637530dc2dc2852,true] 23980 --- [nio-8080-exec-5] com.example.demo.ZipkinApplication : you called home
2017-05-17 15:20:10.084 INFO [zipkin demo,0058e6e4818c17f1,0058e6e4818c17f1,false] 23980 --- [ask-scheduler-1] o.s.i.codec.kryo.CompositeKryoRegistrar : registering [40, java.io.File] with serializer org.springframework.integration.codec.kryo.FileSerializer
2017-05-17 15:20:12.147 ERROR [zipkin demo,6f315febeb5c2176,6f315febeb5c2176,true] 23980 --- [ask-scheduler-1] o.s.integration.handler.LoggingHandler : org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.amqp.outbound.AmqpOutboundEndpoint@5206a959]; nested exception is org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect, failedMessage=GenericMessage [payload=byte[948], headers={spanTraceId=0058e6e4818c17f1, spanId=0058e6e4818c17f1, messageSent=true, id=eb339ffc-5b54-edea-b348-60ca5eac05a1, spanSampled=0, contentType=application/x-java-object;type=org.springframework.cloud.sleuth.stream.Spans, timestamp=1495030810113}]
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:139)
at org.springframework.cloud.stream.binder.AbstractMessageChannelBinder$SendingHandler.handleMessageInternal(AbstractMessageChannelBinder.java:326)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:148)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:121)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:89)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:423)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105)
at org.springframework.integration.endpoint.SourcePollingChannelAdapter.handleMessage(SourcePollingChannelAdapter.java:210)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:272)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.access$000(AbstractPollingEndpoint.java:58)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:190)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:186)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:353)
at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:55)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:51)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:344)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect
at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:62)
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:367)
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:565)
at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1430)
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1411)
at org.springframework.amqp.rabbit.core.RabbitTemplate.send(RabbitTemplate.java:712)
at org.springframework.integration.amqp.outbound.AmqpOutboundEndpoint.send(AmqpOutboundEndpoint.java:134)
at org.springframework.integration.amqp.outbound.AmqpOutboundEndpoint.handleRequestMessage(AmqpOutboundEndpoint.java:122)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:109)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
... 30 more
我部署的第二个应用程序是我的zipkin客户端/ UI
Pom .xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>zipkinClient</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>zipkinClient</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Dalston.RELEASE</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
我的application.class
package com.example.zipkinClient;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ZipkinClientApplication {
public static void main(String[] args) {
SpringApplication.run(ZipkinClientApplication.class, args);
}
}
application.properties
spring.application.name=zipkin server
server.port=9411
运行zipkin服务器它启动正常,但跟踪日志激活中没有显示任何错误
当我去客户端时,我确实得到了这个错误
2017-05-17 15:27:21.822 INFO [zipkin server,,,] 13888 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 9411 (http)
2017-05-17 15:27:21.829 INFO [zipkin server,,,] 13888 --- [ main] c.e.z.ZipkinClientApplication : Started ZipkinClientApplication in 11.14 seconds (JVM running for 12.111)
2017-05-17 15:27:38.513 INFO [zipkin server,,,] 13888 --- [nio-9411-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2017-05-17 15:27:38.514 INFO [zipkin server,,,] 13888 --- [nio-9411-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2017-05-17 15:27:38.638 INFO [zipkin server,,,] 13888 --- [nio-9411-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 124 ms
2017-05-17 15:27:40.828 WARN [zipkin server,,,] 13888 --- [ender@38e778c9)] z.r.AsyncReporter$BoundedAsyncReporter : Dropped 2 spans due to HttpClientErrorException(404 null)
org.springframework.web.client.HttpClientErrorException: 404 null
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:63) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:700) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:653) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:628) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:590) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.cloud.sleuth.zipkin.RestTemplateSender.post(RestTemplateSender.java:73) ~[spring-cloud-sleuth-zipkin-1.2.0.RELEASE.jar:1.2.0.RELEASE]
at org.springframework.cloud.sleuth.zipkin.RestTemplateSender.sendSpans(RestTemplateSender.java:46) ~[spring-cloud-sleuth-zipkin-1.2.0.RELEASE.jar:1.2.0.RELEASE]
at zipkin.reporter.AsyncReporter$BoundedAsyncReporter.flush(AsyncReporter.java:228) [zipkin-reporter-0.6.12.jar:na]
at zipkin.reporter.AsyncReporter$Builder.lambda$build$0(AsyncReporter.java:153) [zipkin-reporter-0.6.12.jar:na]
at zipkin.reporter.AsyncReporter$Builder$$Lambda$1.run(Unknown Source) [zipkin-reporter-0.6.12.jar:na]
这里有任何帮助
提前致谢
答案 0 :(得分:2)
在这里你有一个非常基本的例子:侦探&amp; HTTP通信。 https://github.com/openzipkin/sleuth-webmvc-example您可以以类似的方式设置依赖项,一切都应该正常工作。在你的例子中,你有Stream,但我认为你没有使用它,所以最好删除它。
答案 1 :(得分:0)
正如M.Deinum所说,如果您不需要某个AMQP服务器来存储跟踪消息,请删除stream
和stream-rabbit
依赖项。
或
从应用程序配置(两者)配置AMQP(代码中的rabbitMQ)并添加zipkin-stream
&amp; stream-rabbit
方面的zipkin-server
,所以这次您的应用(zipkin-client
)不会直接与zipkin-server
建立联系
它将是:
zipkin-client <==> AMQP(rabbitMQ) <==> zipkin-server
答案 2 :(得分:-1)
您将需要RabbitMQ(或任何JMS服务器)将日志发送到zipkin。
您可以参考下面的教程以了解更多信息。
http://onlyfullstack.blogspot.com/2018/09/microservices-with-spring-sleuth-and-zipkin.html
在高级别上,您可以按照以下步骤操作
下载zipkin服务器
下载jar文件后,执行以下命令启动zipkin服务器
java -jar zipkin.jar
这将在http://localhost:9411上启动zipkin服务器 3.在pom文件中添加以下条目
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
在application.properties文件中添加以下条目以指定zipkin服务器
spring.zipkin.base-url = http://localhost:9411/
spring.sleuth.sampler.probability = 1