AlgoTraderAlgoTrader Documentation

Chapter 32. Monitoring

32.1. Technical monitoring
32.2. Health check

Available under our the /monitoring endpoint, users can find a comprehensive monitoring tool that exposes various important metrics both real-time and historical. It allows you review:

  • Memory consumption

  • CPU usage

  • JDBC connections in use

  • SQL queries per minute

  • HTTP calls per minute

  • etc

You can also find detailed information on response time of your operations for example order requests:

On top of these there are also a set of admin functionalities exposed. You would typically need to install different tools to perform tasks such as reviewing OS processes or taking a snapshot of the heap memory.

There is a way to see health state of AlogTrader components, e.g. market adapters, data base, Hazelcast caches, JVM

This information is exposed via Rest API and as a web page. Example of the health check page:


Description of columns is the following:


Example of the result as JSON map:


                {
                "JVM": {
                "msg": "HeapMemoryUsage: init = 327155712(319488K) used = 497207792(485554K) committed = 838336512(818688K) max = 4632608768(4524032K), NonHeapMemoryUsage: init = 2555904(2496K) used = 229961040(224571K) committed = 238157824(232576K) max = -1(-1K), ThreadCount: 128, Uptime: 9640403ms, GcCollectionTime: 24082ms, GcCollectionCount: 659",
                "status": "ALIVE"
                },
                "ComboPooledDataSource": {
                "msg": "Connection is valid",
                "status": "ALIVE"
                },
                "HazelcastInstance": {
                "msg": "HazelcastInstance is running",
                "status": "ALIVE"
                },
                "CNB-session": {
                "msg": "loggedOn",
                "status": "ALIVE"
                },
                "CNB-adapter": {
                "msg": "status(es): 404 Not Found",
                "status": "DEAD"
                },
                "CNB-rest-session": {
                "msg": "404 Not Found",
                "status": "DEAD"
                },
                "System": {
                "msg": "all Alive",
                "status": "ALIVE"
                }
                }
            

Rest endpoints:

  • /util/health: returns JSON map with service name mapped to its health state

  • /util/health/html: the same as above but result is a simple HTML table

UI which automatically refresh health status of all components and provides the same information, URL: http://localhost:9090/health.html

Health state is published via ActiveMQ and STOMP, message topics are (for different status levels - alive, unhealthy, dead):

/topic/health-status.dead, example message:
                {"status":"DEAD","msg":"no status updates yet","serviceName":"CNB-session"}
            
/topic/health-status.unhealthy, example message:
                {"status":"UNHEALTHY","msg":"connected","serviceName":"CNB-session"}>
            
/topic/health-status.alive, example message:
                {"status":"ALIVE","msg":"loggedOn","serviceName":"CNB-session"}>
            

Note: all health statuses are propagated to the strategy via method described below:



                public class StrategyService implements ...  HealthStatusListener ...
                ...
                @Override
                public void onHealthStatusChanged(final HealthStatusVO healthStatus) {
                }
                ...