
The GUI is integrated into OLAT via the ExtManager and a subclass of GenericActionExtension. Adding a new kind of statistic is done by adding a section in the olat_extensions.xml, providing a StatisticActionExtension with a Controller classname and a IStatisticManager implementation (see existing olat_extensions.xml for examples).
The Controller normally doesn't have to be extended and one can usually use the existing - generic - StatisticDisplayController. The StatisticDisplayController has a IStatisticManager which it uses for customizing the ColumnDescriptors it uses to display the table as well as for generating the actual statistics. The result of the statistics is encapsulated in its own object called StatisticResult.
Each statistic needs an IStatisticUpdater which is capable of updating the statistics given additional logging actions in the o_loggingtable. The way this update is done is entirely up to the IStatisticUpdater.
The configuration of the IStatisticUpdaters is done in the following file:
olat3/webapp/WEB-INF/src/serviceconfig/org/olat/course/statistic/_spring/olatdefaultconfig.xml
The suggested best practice is to write an updater which is capable of adding new statistic information to an existing table - aka incremental update.
Incremental updates can be further optimized by adding an IStatisticUpdaters (at the first position in the config) which does a
SELECT * FROM o_loggingtable WHERE ACTIONVERB='launch' AND ACTIONOBJECT='node' AND creationdate>...;
The result of this select can be stored in its own temporary delta table which all other IStatisticUpdaters then read their data from - rather than having each of a number of IStatisticUpdaters doing a SELECT in the 'big' o_loggingtable.