This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package ericomonteiro.com.github.catalog.config | |
| import ericomonteiro.com.github.catalog.config.interceptors.TagsTracingGeneratorInterceptor | |
| import org.springframework.context.annotation.Configuration | |
| import org.springframework.web.servlet.config.annotation.InterceptorRegistry | |
| import org.springframework.web.servlet.config.annotation.WebMvcConfigurer | |
| @Configuration | |
| class InterceptorConfig( | |
| private val tagsTracingGeneratorInterceptor: TagsTracingGeneratorInterceptor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Aspect | |
| class TracingAspect { | |
| @Around("execution (* feign.Client.*(..)) && !within(is(FinalType))") | |
| public Object feignClientWasCalled(final ProceedingJoinPoint pjp) throws Throwable { | |
| Object bean = pjp.getTarget(); | |
| if (!(bean instanceof TracingClient)) { | |
| Object[] args = pjp.getArgs(); | |
| return new TracingClientBuilder((Client) bean, tracer) | |
| .withFeignSpanDecorators(spanDecorators) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package ericomonteiro.com.github.sales.controller | |
| import ericomonteiro.com.github.sales.httpclients.CatalogClient | |
| import org.slf4j.Logger | |
| import org.slf4j.LoggerFactory | |
| import org.springframework.web.bind.annotation.GetMapping | |
| import org.springframework.web.bind.annotation.RequestMapping | |
| import org.springframework.web.bind.annotation.RestController | |
| @RestController |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package ericomonteiro.com.github.sales.httpclients | |
| import org.springframework.cloud.openfeign.FeignClient | |
| import org.springframework.http.HttpHeaders | |
| import org.springframework.web.bind.annotation.PostMapping | |
| import org.springframework.web.bind.annotation.RequestBody | |
| import org.springframework.web.bind.annotation.RequestHeader | |
| @FeignClient(value = "catalogClient", url = "\${catalog.httpclient.host}") | |
| interface CatalogClient { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package ericomonteiro.com.github.catalog | |
| import org.springframework.boot.autoconfigure.SpringBootApplication | |
| import org.springframework.boot.runApplication | |
| import org.springframework.cloud.openfeign.EnableFeignClients | |
| @SpringBootApplication | |
| @EnableFeignClients | |
| class CatalogApplication |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package ericomonteiro.com.github.catalog.controller | |
| import ericomonteiro.com.github.catalog.httpclients.ViaCepClient | |
| import org.slf4j.Logger | |
| import org.slf4j.LoggerFactory | |
| import org.springframework.web.bind.annotation.GetMapping | |
| import org.springframework.web.bind.annotation.PostMapping | |
| import org.springframework.web.bind.annotation.RequestBody | |
| import org.springframework.web.bind.annotation.RequestMapping | |
| import org.springframework.web.bind.annotation.RestController |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package ericomonteiro.com.github.catalog.httpclients | |
| import org.springframework.cloud.openfeign.FeignClient | |
| import org.springframework.web.bind.annotation.GetMapping | |
| import org.springframework.web.bind.annotation.PathVariable | |
| @FeignClient(value = "viaCepClient", url = "https://viacep.com.br") | |
| interface ViaCepClient { | |
| @GetMapping("/ws/{zipCode}/json/") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <dependencies> | |
| <dependency> | |
| <groupId>org.springframework.boot</groupId> | |
| <artifactId>spring-boot-starter-web</artifactId> | |
| </dependency> | |
| <dependency> | |
| <groupId>io.opentracing.contrib</groupId> | |
| <artifactId>opentracing-spring-jaeger-cloud-starter</artifactId> | |
| <version>3.3.1</version> | |
| </dependency> |
NewerOlder