feign.opentracing.hystrix.TracingConcurrencyStrategy Java Examples

The following examples show how to use feign.opentracing.hystrix.TracingConcurrencyStrategy. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TracingConfiguration.java    From hola with Apache License 2.0 6 votes vote down vote up
/**
 * This is were the "magic" happens: it creates a Feign, which is a proxy interface for remote calling a REST endpoint with
 * Hystrix fallback support.
 *
 * @return The feign pointing to the service URL and with Hystrix fallback.
 */
@Produces
@Singleton
private AlohaService alohaService(Tracer tracer) {
    // bind current span to Hystrix thread
    TracingConcurrencyStrategy.register();

    return HystrixFeign.builder()
            // Use apache HttpClient which contains the ZipKin Interceptors
            .client(new TracingClient(new ApacheHttpClient(HttpClientBuilder.create().build()), tracer))

            // Bind Zipkin Server Span to Feign Thread
            .logger(new Logger.ErrorLogger()).logLevel(Logger.Level.BASIC)
            .decoder(new JacksonDecoder())
            .target(AlohaService.class,"http://aloha:8080/",
                    () -> Collections.singletonList("Aloha response (fallback)"));
}
 
Example #2
Source File: TracingConfiguration.java    From ola with Apache License 2.0 5 votes vote down vote up
/**
 *
 * This is were the "magic" happens: it creates a Feign, which is a proxy interface for remote calling a
 * REST endpoint with Hystrix fallback support.
 */
@Bean
public HolaService holaService(Tracer tracer) {
    // bind current span to Hystrix thread
    TracingConcurrencyStrategy.register();

    return HystrixFeign.builder()
            .client(new TracingClient(new ApacheHttpClient(HttpClientBuilder.create().build()), tracer))
            .logger(new Logger.ErrorLogger()).logLevel(Logger.Level.BASIC)
            .decoder(new JacksonDecoder())
            .target(HolaService.class, "http://hola:8080/",
                    () -> Collections.singletonList("Hola response (fallback)"));
}
 
Example #3
Source File: HystrixTracingAutoConfiguration.java    From java-spring-cloud with Apache License 2.0 4 votes vote down vote up
@Bean
TracingConcurrencyStrategy hystrixTracingConcurrencyStrategy(Tracer tracer) {
  return TracingConcurrencyStrategy.register(tracer);
}
 
Example #4
Source File: FeignTracingAutoConfiguration.java    From java-spring-cloud with Apache License 2.0 4 votes vote down vote up
@Autowired
public HystrixFeign(Tracer tracer) {
  TracingConcurrencyStrategy.register(tracer);
}