|
3 | 3 | import java.util.Collections; |
4 | 4 | import java.util.regex.Pattern; |
5 | 5 |
|
6 | | -import org.apache.http.impl.client.HttpClientBuilder; |
7 | | -import org.springframework.context.annotation.Bean; |
8 | | -import org.springframework.context.annotation.Configuration; |
9 | | - |
10 | | -import com.uber.jaeger.metrics.Metrics; |
11 | | -import com.uber.jaeger.metrics.NullStatsReporter; |
12 | | -import com.uber.jaeger.metrics.StatsFactoryImpl; |
13 | | -import com.uber.jaeger.reporters.RemoteReporter; |
14 | | -import com.uber.jaeger.samplers.ProbabilisticSampler; |
15 | | -import com.uber.jaeger.senders.Sender; |
16 | | -import com.uber.jaeger.senders.UdpSender; |
17 | | - |
18 | 6 | import feign.Logger; |
19 | 7 | import feign.httpclient.ApacheHttpClient; |
20 | 8 | import feign.hystrix.HystrixFeign; |
21 | 9 | import feign.jackson.JacksonDecoder; |
22 | 10 | import feign.opentracing.TracingClient; |
23 | 11 | import feign.opentracing.hystrix.TracingConcurrencyStrategy; |
24 | | -import io.opentracing.NoopTracerFactory; |
25 | 12 | import io.opentracing.Tracer; |
26 | 13 | import io.opentracing.contrib.spring.web.autoconfig.WebTracingConfiguration; |
| 14 | +import org.apache.http.impl.client.HttpClientBuilder; |
| 15 | +import org.springframework.beans.factory.annotation.Autowired; |
| 16 | +import org.springframework.context.annotation.Bean; |
| 17 | +import org.springframework.context.annotation.Configuration; |
27 | 18 |
|
28 | 19 | /** |
29 | 20 | * @author Pavol Loffay |
30 | 21 | */ |
31 | 22 | @Configuration |
32 | 23 | public class TracingConfiguration { |
33 | 24 | private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(TracingConfiguration.class); |
34 | | - private static final String SERVICE_NAME = "ola"; |
35 | | - |
36 | | - @Bean |
37 | | - public Tracer tracer() { |
38 | | - String jaegerURL = System.getenv("JAEGER_SERVER_HOSTNAME"); |
39 | | - if (jaegerURL != null) { |
40 | | - log.info("Using Jaeger tracer"); |
41 | | - return jaegerTracer(jaegerURL); |
42 | | - } |
43 | | - |
44 | | - log.info("Using Noop tracer"); |
45 | | - return NoopTracerFactory.create(); |
46 | | - } |
47 | | - |
48 | | - |
49 | | - private Tracer jaegerTracer(String url) { |
50 | | - Sender sender = new UdpSender(url, 0, 0); |
51 | | - return new com.uber.jaeger.Tracer.Builder(SERVICE_NAME, |
52 | | - new RemoteReporter(sender, 100, 50, |
53 | | - new Metrics(new StatsFactoryImpl(new NullStatsReporter()))), |
54 | | - new ProbabilisticSampler(1.0)) |
55 | | - .build(); |
56 | | - } |
57 | 25 |
|
| 26 | + @Autowired |
| 27 | + public Tracer tracer; |
58 | 28 |
|
59 | 29 | @Bean |
60 | 30 | public WebTracingConfiguration webTracingConfiguration() { |
|
0 commit comments