3

有没有其他人在使用 Zipkin 和 Spring Cloud Sleuth 时遇到过以下问题?将数据发布到我的本地 Zipkin 服务器似乎是个问题。是否需要在 Zipkin 上配置代理设置?

2016-11-17 12:13:59.270 DEBUG [myService,,,] 16588 --- [pool-1-thread-1] o.s.c.s.zipkin.HttpZipkinSpanReporter    : error POSTing spans to http://localhost:9411/api/v1/spans: as json {span data}

java.net.ConnectException: Connection refused (Connection refused)
    at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_112]
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_112]
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_112]
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_112]
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_112]
    at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_112]
    at java.net.Socket.connect(Socket.java:538) ~[na:1.8.0_112]
    at sun.net.NetworkClient.doConnect(NetworkClient.java:180) ~[na:1.8.0_112]
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:432) ~[na:1.8.0_112]
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:527) ~[na:1.8.0_112]
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:211) ~[na:1.8.0_112]
    at sun.net.www.http.HttpClient.New(HttpClient.java:308) ~[na:1.8.0_112]
    at sun.net.www.http.HttpClient.New(HttpClient.java:326) ~[na:1.8.0_112]
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202) ~[na:1.8.0_112]
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138) ~[na:1.8.0_112]
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032) ~[na:1.8.0_112]
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966) ~[na:1.8.0_112]
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1316) ~[na:1.8.0_112]
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1291) ~[na:1.8.0_112]
    at org.springframework.cloud.sleuth.zipkin.HttpZipkinSpanReporter.postSpans(HttpZipkinSpanReporter.java:146) ~[spring-cloud-sleuth-zipkin-1.0.0.RELEASE.jar:1.0.0.RELEASE]
    at org.springframework.cloud.sleuth.zipkin.HttpZipkinSpanReporter.flush(HttpZipkinSpanReporter.java:96) ~[spring-cloud-sleuth-zipkin-1.0.0.RELEASE.jar:1.0.0.RELEASE]
    at org.springframework.cloud.sleuth.zipkin.HttpZipkinSpanReporter$Flusher.run(HttpZipkinSpanReporter.java:124) [spring-cloud-sleuth-zipkin-1.0.0.RELEASE.jar:1.0.0.RELEASE]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_112]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_112]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_112]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_112]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_112]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_112]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_112]
4

1 回答 1

3

请确保在您的 Spring Boot 配置文件中正确配置您的 zipkin 服务器。像这样:

    logging:
      level.org.springframework.cloud: DEBUG
    spring:
      application:
        name: service-tracking
      sleuth:
        enabled: false
    zipkin:
        storage:
            type: mem
    server:
        port: 9411

并在您的 zipkin 客户端 spring boot 配置文件中添加以下配置:

  sleuth:
        enabled: true
        sampler:
          percentage: 1
      zipkin:
        enabled: true
        baseUrl: http://${tracking-host:tracking}:9411
于 2017-05-10T09:29:15.383 回答