anthunt / spring-boot-aws-xray-sample

AWS XRay tracing helper configuration and Demo for spring boot with java.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

spring-boot-aws-xray-sample for AWS XRay

Hits Java License Gitpod Codacy Badge Build Status Maven Package Java CI with Maven

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

Screenshot of the AWS X-Ray Trace console

Features

  1. Incoming Servlet request tracing with Spring AOP
  2. Outgoing HttpRequest tracing with FeignClient
  3. 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

About

AWS XRay tracing helper configuration and Demo for spring boot with java.

License:Apache License 2.0


Languages

Language:Java 100.0%