AgE 2.7 : (T) Monitoring

Modules

  • monitoring-monitoring-core
  • monitoring-age-bindings - suppliers, 
  • monitoring-age-visualization - visualization and persistence, 
  • monitoring-graphite - example with Graphite tool.

Main concept of monitoring

In the monitoring module, RxJava library is used widely. The main concept of monitoring is based on the following components:

  • supplier - responsible for providing wanted data on request; supplier class implements com.google.common.base.Supplier interface;
  • observable - connection of supplier and time interval (rate)
  • observer - takes and process data provided by observable; observer extends AbstractObserver class;
  • handler - subscribes observer on observable;

What is computation type and computation instance?

Most of observers (all except console) bind two addition parameters. Each data which is pushed to observer can be identified by three parameters named: computation type, computation instance and handler name.

Computation type describes a type/kind/family of some computations, i.e. emas or vanilla-genetic. Computation instance, refers to concrete execution of computation. All created observers which use computation instance assume that the value of this parameter indicates the timestamp generated in the moment when a computation was started. Component which provides that value must implement org.jage.monitoring.config.ComputationInstanceProvider interface.

Adding new supplier / observer component

Supplier and observer components are loaded with ServiceLoader class. You can create new supplier or observer in your own maven module, 

  • Create your component which implements com.google.common.base.Supplier or extends AbstractObserver class; actually this step can be not obligatory, just like i.e. ReferenceProducerProvider case.
  • Create provider of your component which implements SupplierProvider or ObserverProvider interface; provider should instantiate created component and passes requested arguments if needed.
  • In src/main/resources folder (which must be in classpath), create folder META-INF/services and put the file named as the interface of the provider which you implemented in the previous point, so it would be org.jage.monitoring.supplier.SupplierProvider or org.jage.monitoring.observer.ObserverProvider. The file must contains the name (or names) of providers which are brought with the module; this is because the requirements of ServiceLoader, which is described here.
  • Run mvn clean install.

  • Add the dependency on created module to your main application.
  • Now in Typesafe Config monitoring you can define new producer/consumer by using type name while implementing getType() method of SupplierProvider /ObserverProvider interface.

Adding new handler

RxJava library which is used in monitoring module, brings many benefits. One of them is the possibility of construct your own handler. You can use RxJava to compose observables in many different ways. See what RxJava offers and look at it's API.

When you already have you new handler, you can use it in TypeSafe or XML configuration file. where the handler's class and the method's name must be specify.

Functional tests

For the purposes of functional tests, use RxTestSchedulerProvider component, instead of RxComputationSchedulerProvider. Refer to RxJava testing schedulers article.

Known issues

  • Accumulation gathered data after start monitoring