I'm new to aws x-ray and trying to use x-ray with AOP based approach in a springboot application. I was able to get the traces in the aws console, but traces doesn't show inner method call method2() details. Am I missing anything here.
Controller class
import com.amazonaws.xray.spring.aop.XRayEnabled;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/xray")
@XRayEnabled
public class XrayController {
@GetMapping(value = "/method1")
public String method1() {
return method2();
}
public String method2() {
return "Hello";
}
}
Aspect Class
import com.amazonaws.xray.entities.Subsegment;
import com.amazonaws.xray.spring.aop.BaseAbstractXRayInterceptor;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
import java.util.Map;
@Aspect
@Component
public class XRayInspector extends BaseAbstractXRayInterceptor {
@Override
protected Map<String, Map<String, Object>> generateMetadata(ProceedingJoinPoint proceedingJoinPoint, Subsegment subsegment) {
return super.generateMetadata(proceedingJoinPoint, subsegment);
}
@Override
@Pointcut("@within(com.amazonaws.xray.spring.aop.XRayEnabled) && (bean(*Controller) || bean(*Service) || bean(*Client) || bean(*Mapper))")
public void xrayEnabledClasses() {}
}
When I hit http://localhost:8080/xray/method1 endpoint, AWS Xray Console doesn't show method2() details