Skip to content

Cantara/Valuereporter-Agent

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Valuereporter-Agent

Build Status - Project Status: Active – The project has reached a stable, usable state and is being actively developed. - Known Vulnerabilities

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.

Installation

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 \

Configuration

  • 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

Future improvements

  • 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.

Manual Testing

Use class CommandActivitySenderTest

Installation included in your service

In your main class:

 //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 usage

// Report to Valuereporter
ObservedActivity observedActivity = new ObservedActivity(activityName, System.currentTimeMillis());
MonitorReporter.reportActivity(observedActivity);

Migrate to 1.0

  • serviceName -> serviceName : More consistent naming.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%