Java (Java Agent, Installation, JVM, and Controller Installation)

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Correlation for Spark Java

New Poster

Custom Correlation for Spark Java

Hi all,

 

I am working with a Java Spark application: http://sparkjava.com/ which runs with a Jetty Server.

I am having trouble getting AppDynamics to reconise the incomming connections. I have got the app agent working, and I can see connections being made externally via the jdbcTemplate. We have controller classes which are of the form similar to as follows:

 

public class HealthCheckController {

private final HealthCheckService healthCheckService;

public HealthCheckController(final HealthCheckService healthCheckService) {
this.healthCheckService = healthCheckService;
}

public String healthCheck(final Request request, final Response response) {
response.type("text/plain");

if (healthCheckService.ok()) {
return "OK";
} else {
response.status(500);
return "ILL";
}
}

}

 

I have tried generating custom Business Transactions and Entry Points using POJO and matching classes ending with Controller and all method. This seems to have found the incoming requests, as I can see the error rate within these transactions, however, when I view the Dashboard of other applications, the outgoing connections go to an unknown http service, rather than the Spark projects Tier/Nodes.

I believe what I need to set up is a custom correlation configuration, which I will do as an xml file which I can include in the app agent configuration, but I can't find any documentation as to what should be in this file or any worked examples.

 

I would like to define a custom entry point, entirely in xml, so that I can deploy other Spark apps based off the same configuration, with a customer entry point. Ideally matching all methods which belong to a class containing the word "Controller" which have the parameters, (spark.Request request, spark.Response response).

From the request, I can get the javax.servlet.http.HttpServerRequest, and I can use this to access headers and I assume get the correlation GUID from that?

 

Any advise would be great.

 

Thanks

 

Anthony

Custom Correlation for Spark Java