I use the elasticsearch/kibana/APM server 6.6 version, and APM java agent 1.3 version.
In my test, I use spring cloud (Greenwich.RELEASE
) as the distributed micro service framework and use netflix eureka as the service registry center.
Here, I just show the consumer code:
@Controller
@RequestMapping( "/user" )
public class ConsumerController
{
@Autowired
UserRemote userRemote;
@RequestMapping( "/get" )
@ResponseBody
public String getUserWithEureka()
{
return userRemote.getUser();
}
@RequestMapping( "/get2" )
@ResponseBody
public String indexWithUrl()
{
RestTemplate restTemplate = new RestTemplate();
String results = restTemplate.getForObject("http://localhost:8001/user/showUser", String.class);
return results;
}
}
in above code, when I access api by /user/get
, it will call the remote Restful API by eureka client. when I access api by /user/get2
, it will directly get it by HTTP
I only deploy one micro service, so, these two way actually calling the same instance.
Two transaction are catch by apm agent. for the one directly call HTTP restful, it is able to do distributed trace:
for the one use eureka, it didn't:
do we have any plan to support spring cloud or dubbo?