spring-boot-aws-xray-sample for AWS XRay
As the transition to MSA-oriented application services accelerates, it becomes more important to track complex invocation relationships between microservices. AWS provides the X-Ray service as a service for tracking and managing the call relationships between many of these services. This service integrates with AWS’s API Gateway service, making it easy to monitor the call relationship to service requests and the performance of your application calls. However, it does require a bit of coding to track execution within the application. It is therefore open source providing sample code for easy integration of X-Ray tracing into SpringBoot applications. This feature leverages SpringBoot’s AOP capabilities to provide an easy way to apply X-Ray without affecting existing application code.
AWS X-Ray Screenshot
Features
- Incoming Servlet request tracing with Spring AOP
- Outgoing HttpRequest tracing with FeignClient
- Database Query tracing with HikariCP
Description
config/AWSXRayConfig.java
- Configure SpringBoot Project Preferences for AWS X-Ray
config/AWSXRayInspector.java
- Configuration of trace function for bean execution in SpringBoot with AOP
- Bean scope setting for tracking by Annotation setting
@Pointcut("@within(com.amazonaws.xray.spring.aop.XRayEnabled) && (bean(*Controller) || bean(*Service) || bean(*Client) || bean(*Mapper))")
config/AWSXRayFeignClientConfig.java
- Configure tracing function for FeignClient execution for outbound request tracing
config/AWSXRayHikariConfig.java
- Set up integration with HikariCP for tracking database calls
config/AWSXRayTracingConnection.java, AWSXRayTracingDataSource.java, AWSXRayTracingStatement.java
- Configure tracking function for query invocation by providing wrapping function for JDBC configuration objects