0

I am working on Spring Boot and Cloud Sleuth, migrating from Spring Boot v1.4.1.RELEASE to Spring Boot 2.2.6.RELEASE.

When I upgraded maven dependency, my code started breaking

CustomSampler.java

import org.springframework.cloud.sleuth.Sampler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import zipkin2.Span;

@Configuration

    public class CustomSampler {

        @Bean
        public Sampler smartSampler() {

            return new Sampler() {
                @Override
                public boolean isSampled(Span span) {
                    System.out.println("custom sampler used!");
                    return true;
                }
            };

        }
    }

I went through this link : https://github.com/spring-cloud/spring-cloud-sleuth/wiki/Spring-Cloud-Sleuth-2.0-Migration-Guide, but things are not clear.

enter image description here

PAA
  • 1
  • 46
  • 174
  • 282
  • https://github.com/spring-cloud/spring-cloud-sleuth/wiki/Spring-Cloud-Sleuth-2.0-Migration-Guide there was a big refactor from 1.x to 2.x for Sleuth – Darren Forsythe Apr 20 '20 at 17:45
  • Even the same link I have given in my post, just not clear what's the alternative for this – PAA Apr 20 '20 at 17:47
  • Whoops missed that, its stated that the brave sampler is the replacement. " Sampler Sampler from Brave needs to be used", it should be located at `brave.sampler.Sampler`. You can see their basic impls of the sampler's, https://github.com/openzipkin/brave/blob/master/brave/src/main/java/brave/sampler/Sampler.java – Darren Forsythe Apr 21 '20 at 10:27

0 Answers0