webleads-tracker

Document Reference
Progress on accounting and billing
Publication Information
Embedded

Lately, SlapOS has been improving a lot on the accounting and billing frontline.

Progress on accounting and billing can be tracked in the on the slapos.core repository, in the "usage_report" branch:

http://git.erp5.org/gitweb/slapos.core.git/tree/usage_report?js=1

Fixed Point Data Integration

This branch includes unit tests which check that the collection of usage reports - the key for further accounting and billing - is implemented as expected on the SlapOS Master side. The main unit test asserts that XML accounting and metering data which is sent to SlapOS Master can be imported without information loss into SlapOS master. Following the typical ERP5ish approach of "fixed point" data integration based, inspired by SyncML, imported data in XML format is compared to the already present data which itself is exported in XML format. Whenever the two match, we have a so-called "fixed point" which demonstrates that the data integration process is reliable.

The unit test which implements fixed point data integration can be found here:

http://git.erp5.org/gitweb/slapos.core.git/blob/usage_report:/master/product/Vifib/tests/testUsageReport.py?js=1

A typical example of XML data which is used to exchange accounting and metering data is also available:

http://git.erp5.org/gitweb/slapos.core.git/blob/usage_report:/master/bt5/vifib_test/SkinTemplateItem/portal_skins/vifib_test/ERP5Site_getUsageReportTestSample.xml?js=1

Accounting and metering data is based on an XML schema descibed here:

http://git.erp5.org/gitweb/slapos.core.git/blob/usage_report:/xsd/computer_consumption.xsd?js=1

In a short distance future, JSON schema will also be support and JSON data will become the default option for accounting and metering information.

Process Accounting: KVM case

SlapOS includes a utility called "monitor" to implement process accounting and metering. It is part of slapos.toolbox repository. This utility tracks the memory and CPU usage of a group of processes. It is used in particular to track how much CPU and memory a KVM virtual machine instance uses. It could also be used to track similar information for a database (ex. MariaDB) or for a front-end process (ex. Apache). The  "usage_report" branch includes its own version of the monitor utility:

http://git.erp5.org/gitweb/slapos.toolbox.git/blob/usage_report:/slapos/monitor.py?js=1

The monitor tool is what is used in a typical SlapOS setup to generate the accounting and metering information which is then imported into SlapOS Master. Based on this information, SlapOS Master generated so-called "Packing Lists" which are the standard ERP5 object to represent the actual delivery of goods or services. Through ERP5 simulation, invoices can be generated automatically based on pricing information and pricing rules. This part is implemented but not yet fully tested.

This report was written by Seb and Jean-Paul.