This agent will monitor all calls to public methods. When a method is called, start-time and end-time will be forwarded to the Valuereporter service.
Start your appserver/program with an additional command -javaagent:=
Example:
java -javaagent:../valuereporter-agent/valuereporter-agent-jar-with-dependencies.jar= \
base.package:com.example,valuereporter.host:localhost,valuereporter.port:4901,serviceName:myService \
-jar <your jar file>
Example Tomcat:
In catalina.bat, add to top of the file.
SET JAVA_OPTS=%JAVA_OPTS% -javaagent:../valuereporter-agent/valuereporter-agent-jar-with-dependencies.jar= \
base.package:com.example,valuereporter.host:localhost,valuereporter.port:4901,serviceName:myService \
- base.package - The package you want to scan. Example: com.example
- valuereporter.host - Where ValueReporter is running. (optional) Example: localhost
- valuereporter.port - Port of ValueReporter (optional) Example: 8080
- serviceName - unique identifier for this service, and node. Used to identify the input from multiple services and nodes, in Valuereporter
Optional parameters:
- valuereporter.activity.batchsize Default is 500
- valuereporter.activity.postintervalms Default is 500
-
When multiple methods has the same name, and different parameters, they will now be reported as one method. For the time beeing, this is not a crucial factor, thoug. When the GUI of Valuereporter are able show these variations with the same method name, in a propper way. Then we can start reporting on individual variations from the same method- name.
-
Time-based reporting. Ensure that data are sent from Valuereporter-agent at given intervals. Current implementation will, when activity on the monitored application is low, hold the data for a long period of time.
Use class CommandActivitySenderTest
//Start Valuereporter event distributer.
try {
String reporterHost = appConfig.getProperty("valuereporter.host");
String reporterPort = appConfig.getProperty("valuereporter.port");
String serviceName = appConfig.getProperty("applicationname");
int cacheSize = Integer.parseInt(appConfig.getProperty("valuereporter.activity.batchsize"));
int forwardInterval = Integer.parseInt(appConfig.getProperty("valuereporter.activity.postintervalms"));
new Thread(new ObservedActivityDistributer(reporterHost, reporterPort, serviceName, cacheSize, forwardInterval)).start();
new Thread(new HttpObservationDistributer(reporterHost, reporterPort, serviceName)).start();
} catch (Exception e) {
log.warn("Error in valueReporter property configuration - unable to start observers");
}
// Report to Valuereporter
ObservedActivity observedActivity = new ObservedActivity(activityName, System.currentTimeMillis());
MonitorReporter.reportActivity(observedActivity);
- serviceName -> serviceName : More consistent naming.