简体   繁体   English

Zipkin未显示跟踪日志

[英]Zipkin not showing trace logs

Hi Hoping somebody can help am trying to get a very basic implementation of zipkin working to get to grips with distributed tracing. 您好,希望有人能帮助您获得zipkin的一个非常基本的实现,以帮助您掌握分布式跟踪。 I am using the spring boot to do this but cannot seem to get it to work. 我正在使用弹簧靴来执行此操作,但似乎无法使其正常工作。 Nothing appears in the zipkin UI when I try to find traces for a my service. 当我尝试查找服务跟踪时,zipkin UI中什么也没有出现。

I have got 2 deployments as follows: 我有2个部署,如下所示:

My spring boot app which I am wanting to log: 我想登录的我的spring boot应用程序:

pom.xml 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>

With these dependencies I do get a connect error because of the rabbit mq dependency. 有了这些依赖关系,由于Rabbit mq依赖关系,我确实出现了连接错误。 I had to include this becuase I got a META-INF/spring binders error. 因为我遇到了META-INF / spring活页夹错误,所以我不得不将其包括在内。 Wasnt really sure how to get around this other than putting the dependency in. 除了确定依赖关系之外,是否真的确定如何解决这个问题。

My application.class 我的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);
    }
}

When I run this aplication and call my endpoint I can see through the logging that it should be sending it to zipkin. 当我运行此应用程序并调用端点时,通过日志可以看到它应该将其发送到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

This are my full logs. 这是我的完整日志。 Again I get the rabbitmq exception but not sure why i actually need this. 再次,我得到了rabbitmq异常,但不确定为什么我实际上需要这个。 Can zipkin not work without it 没有它,zipkin不能工作吗

My full logs: 我的完整日志:

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

The 2nd application I deployed is my zipkin client / UI 我部署的第二个应用程序是我的zipkin客户端/ UI

Pom .xml 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>

My application.class 我的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 application.properties

spring.application.name=zipkin server
server.port=9411

Running the zipkin server it starts up ok but nothing is shown in the trace logs excpet for an error 运行zipkin服务器,它可以正常启动,但在跟踪日志摘录中未显示任何错误

When I go to the client I do get this error though 当我去拜访客户时,我确实会收到此错误

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]

Any help is appreciated here 任何帮助在这里表示赞赏

Thanks in advance 提前致谢

Here you have a very basic example of Sleuth & HTTP communication. 在这里,您有一个Sleuth和HTTP通信的非常基本的示例。 https://github.com/openzipkin/sleuth-webmvc-example You can set your dependencies in a similar manner and everything should work fine. https://github.com/openzipkin/sleuth-webmvc-example您可以以类似的方式设置依赖项,并且一切正常。 In your example you've got Stream but I don't think you're using it so it's better to remove it. 在您的示例中,您拥有Stream,但我不认为您正在使用它,因此最好将其删除。

As M.Deinum said remove stream and stream-rabbit dependencies what if you do not need some AMQP server to store the trace message. 正如M.Deinum所说,删除streamstream-rabbit依赖关系,如果不需要某些AMQP服务器来存储跟踪消息该怎么办。

or 要么

config the AMQP(rabbitMQ in your code) from application-configuration(both) and add zipkin-stream & stream-rabbit in zipkin-server side, so this time your app( zipkin-client ) will not direct connect with zipkin-server and it will be: 从应用程序配置(两者)配置AMQP(代码中的rabbitMQ)并在zipkin-server端添加zipkin-streamstream-rabbit ,因此这一次您的应用程序( zipkin-client )将不直接与zipkin-server和这将是:

zipkin-client <==> AMQP(rabbitMQ) <==> zipkin-server

You will need rabbitMQ(or any JMS server) to send the logs to zipkin. 您将需要RabbitMQ(或任何JMS服务器)将日志发送到zipkin。

You can refer to below tutorial to get more idea about it. 您可以参考下面的教程以了解更多信息。

http://onlyfullstack.blogspot.com/2018/09/microservices-with-spring-sleuth-and-zipkin.html http://onlyfullstack.blogspot.com/2018/09/microservices-with-spring-sleuth-and-zipkin.html

On high level you can follow below steps 在较高级别,您可以按照以下步骤操作

  1. Download the zipkin server 下载zipkin服务器

  2. After downloading the jar file fire below command to start the zipkin server 下载完jar文件后,执行以下命令启动zipkin服务器

    java -jar zipkin.jar java -jar zipkin.jar

This will start the zipkin server on http://localhost:9411 3. Add below entry in your pom file 这将在http:// localhost:9411上启动zipkin服务器。3.在pom文件中添加以下条目

<dependency>
 <groupId>org.springframework.cloud</groupId>
 <artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency> 
  1. Add below entry in application.properties file to specify the zipkin server 在application.properties文件中添加以下条目以指定zipkin服务器

    spring.zipkin.base-url= http://localhost:9411/ spring.zipkin.base-url = http:// localhost:9411 /

    spring.sleuth.sampler.probability=1 spring.sleuth.sampler.probability = 1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM