0
votes

we are trying to use sleuth to send logs to zipkin. We are using spring boot '2.2.6.RELEASE' and cloud version Hoxton.RELEASE. I have added below dependencies

implementation "org.springframework.cloud:spring-cloud-starter-zipkin:2.2.6.RELEASE"
implementation "org.springframework.cloud:spring-cloud-starter-sleuth:2.2.6.RELEASE"
implementation "org.springframework.cloud:spring-cloud-sleuth-zipkin:2.2.6.RELEASE"

And added below props in logback.xml [%X{traceId} %X{spanId} %X{X-Span-Export}]

With the above changes in our 2 services, we were expecting zipkin will have some logs, but nothing appeared. So then we tried to add below properties in application.properties

spring.zipkin.base-url=http://localhost:9411
spring.zipkin.enabled=true
spring.zipkin.service.name=xyz-service
spring.sleuth.enabled=true
spring.sleuth.integration.enabled=true
spring.sleuth.sampler.rate=100
spring.sleuth.sampler.probability=1.0
spring.zipkin.sender.type=web

And still dont see logs / service name in zipkin. Can you see what am I doing wrong here. Out apps have cloud-stream dependencies as well. And also noted that in logs I am getting X-span-export coming as false. For ex: [3e205e41db60212f 77a405a53d62c9fa false]

1
You have not provided any meaningful information. We have no idea which version of Sleuth & Spring Cloud you're using. You are providing unnecessary dependencies (if you have starter-zipkin you don't need sleuth-zipkin if you're using an older version). If you're using the newer once you don't need starter-zipkin. You're enabling properties that are enabled by default. Zipkin does not store logs - it stores spans. - Marcin Grzejszczak
thanks for the suggestions, i updated my question. I added default props as i cant get traces and spans into zipkin - nani21984
you shouldn't be setting the versions manually. Please add the bom and the versions wlil be set out of the box. Also Hoxton.RELEASE is old, please upgrade to the latest version. Also you don't need to set the defaults manually cause the defaults are set automatically. The only thing you should set is the probability to 1.0 then you'll send all the spans to Zipkin. - Marcin Grzejszczak
@MarcinGrzejszczak I would like accept your comment as answer, updating to latest spring boot and spring cloud dependencies did work. Thanks a ton - nani21984
I've posted an answer - Marcin Grzejszczak

1 Answers

2
votes

Please upgrade the project to the latest version of Spring Boot and Spring Cloud. Also use the BOM as the source of versions - do not set them manually. Please do not set the default properties manually cause as defaults they are already set.