为什么服务不能以zipkin显示?

时间:2018-09-18 01:26:02

标签: spring-cloud zipkin spring-cloud-sleuth

  • 我使用Spring Boot: 1.5.16
  • 春季云: Edgware.RELEASE
  • Java: 1.8

我的采样器如下:

 @Bean
    public Sampler sampler(){
        return new AlwaysSampler();
 }

在尤里卡(Eureka),一切似乎都很好: enter image description here

但是我的问题是,在Zipkin中我根本看不到服务。 enter image description here

我只找到调试日志,没有错误:

2018-09-18 05:15:53.831 DEBUG [reservation-client,,,] 3759 --- [io-9999-exec-10] o.s.c.sleuth.instrument.web.TraceFilter  : Received a request to uri [/reservations] that should not be sampled [false]
2018-09-18 05:15:53.832 DEBUG [reservation-client,950c6b586ebb2d56,950c6b586ebb2d56,true] 3759 --- [io-9999-exec-10] o.s.c.sleuth.instrument.web.TraceFilter  : No parent span present - creating a new span
2018-09-18 05:15:53.832 DEBUG [reservation-client,950c6b586ebb2d56,950c6b586ebb2d56,true] 3759 --- [io-9999-exec-10] o.s.c.s.i.web.TraceHandlerInterceptor    : Handling span [Trace: 950c6b586ebb2d56, Span: 950c6b586ebb2d56, Parent: null, exportable:true]
2018-09-18 05:15:53.832 DEBUG [reservation-client,950c6b586ebb2d56,950c6b586ebb2d56,true] 3759 --- [io-9999-exec-10] o.s.c.s.i.web.TraceHandlerInterceptor    : Adding a method tag with value [writeReservation] to a span [Trace: 950c6b586ebb2d56, Span: 950c6b586ebb2d56, Parent: null, exportable:true]
2018-09-18 05:15:53.832 DEBUG [reservation-client,950c6b586ebb2d56,950c6b586ebb2d56,true] 3759 --- [io-9999-exec-10] o.s.c.s.i.web.TraceHandlerInterceptor    : Adding a class tag with value [ReservationApiGatewayRestController] to a span [Trace: 950c6b586ebb2d56, Span: 950c6b586ebb2d56, Parent: null, exportable:true]
2018-09-18 05:15:53.833  INFO [reservation-client,950c6b586ebb2d56,950c6b586ebb2d56,true] 3759 --- [io-9999-exec-10] .e.r.ReservationApiGatewayRestController : VQ start sending!!!
2018-09-18 05:15:53.833 DEBUG [reservation-client,950c6b586ebb2d56,950c6b586ebb2d56,true] 3759 --- [io-9999-exec-10] o.s.c.s.i.m.TraceChannelInterceptor      : Processing message before sending it to the channel
2018-09-18 05:15:53.833 DEBUG [reservation-client,950c6b586ebb2d56,950c6b586ebb2d56,true] 3759 --- [io-9999-exec-10] o.s.c.s.i.m.TraceChannelInterceptor      : Parent span is [Trace: 950c6b586ebb2d56, Span: 950c6b586ebb2d56, Parent: null, exportable:true]
2018-09-18 05:15:53.833 DEBUG [reservation-client,950c6b586ebb2d56,950c6b586ebb2d56,true] 3759 --- [io-9999-exec-10] o.s.c.s.i.m.TraceChannelInterceptor      : Name of the span will be [message:output]
2018-09-18 05:15:53.833 DEBUG [reservation-client,950c6b586ebb2d56,74b3c2b9366ff711,true] 3759 --- [io-9999-exec-10] o.s.c.s.i.m.TraceChannelInterceptor      : Marking span with client send
2018-09-18 05:15:53.833 DEBUG [reservation-client,950c6b586ebb2d56,74b3c2b9366ff711,true] 3759 --- [io-9999-exec-10] o.s.c.s.i.m.TraceChannelInterceptor      : Completed sending and current span is [Trace: 950c6b586ebb2d56, Span: 74b3c2b9366ff711, Parent: 950c6b586ebb2d56, exportable:true]
2018-09-18 05:15:53.833 DEBUG [reservation-client,950c6b586ebb2d56,74b3c2b9366ff711,true] 3759 --- [io-9999-exec-10] o.s.c.s.i.m.TraceChannelInterceptor      : Marking span with client received
2018-09-18 05:15:53.833 DEBUG [reservation-client,950c6b586ebb2d56,74b3c2b9366ff711,true] 3759 --- [io-9999-exec-10] o.s.c.s.i.m.TraceChannelInterceptor      : Closing messaging span [Trace: 950c6b586ebb2d56, Span: 74b3c2b9366ff711, Parent: 950c6b586ebb2d56, exportable:true]
2018-09-18 05:15:53.833 DEBUG [reservation-client,950c6b586ebb2d56,74b3c2b9366ff711,true] 3759 --- [io-9999-exec-10] o.s.c.s.zipkin2.DefaultEndpointLocator   : Span will contain serviceName [reservation-client]
2018-09-18 05:15:53.834 DEBUG [reservation-client,950c6b586ebb2d56,950c6b586ebb2d56,true] 3759 --- [io-9999-exec-10] o.s.c.s.i.m.TraceChannelInterceptor      : Messaging span [Trace: 950c6b586ebb2d56, Span: 74b3c2b9366ff711, Parent: 950c6b586ebb2d56, exportable:true] successfully closed
2018-09-18 05:15:53.834 DEBUG [reservation-client,950c6b586ebb2d56,950c6b586ebb2d56,true] 3759 --- [io-9999-exec-10] o.s.c.sleuth.instrument.web.TraceFilter  : Closing the span [Trace: 950c6b586ebb2d56, Span: 950c6b586ebb2d56, Parent: null, exportable:true] since the response was successful
2018-09-18 05:15:53.834 DEBUG [reservation-client,950c6b586ebb2d56,950c6b586ebb2d56,true] 3759 --- [io-9999-exec-10] o.s.c.s.zipkin2.DefaultEndpointLocator   : Span will contain serviceName 

问题很简单。为什么在Zipkin中看不到任何内容? 该示例由Josh Long.

编写

1 个答案:

答案 0 :(得分:0)

检查您的配置文件,并确保在此处正确指定了baseUrl

    spring.zipkin.baseUrl