Skip to content
Advertisement

X-Ray trace doesn’t shows inner method call

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

JavaScript

Aspect Class

JavaScript

When I hit http://localhost:8080/xray/method1 endpoint, AWS Xray Console doesn’t show method2() details

AWS Xray Console doesn't show method2 details

Advertisement

Answer

As I later understood with the use of M. Deinum’s comment AOP prevents you to wrap a function if it is in the caller is in the same class of the callee.

Read more on AOP https://docs.spring.io/spring-framework/docs/current/reference/html/core.html#aop-understanding-aop-proxies

You can use a work around using below self injection

JavaScript

notice here we call the method 2 by test.method2(); instead of this.method2()

I referred below answer also for this solution Spring AOP not working for method call inside another method

Advertisement