Skip to content

Stats

An interface to store and track time-series statistics. There are several system level statistics already tracked, which can be viewed over at Stats module. However, this interface allows users to measure and track their own metrics throughout the life-cycle of the Algodab server. Stats methods do not take 'symbol' as a parameter because they are meant to refer to system as a whole. If want to track stats per individual symbol, you can just name the measurements appropriately, i.e. Stats.push('AMC-duration', 19.8);

Stats.push

Stats.push("measurement", value)

Stores a specified measurement as time-series measurement with the current timestamp. The storage database of choice is InfluxDB and visualization is done with Grafana dashboard which can be accessed on the main screen (Stats)

Parameters

Parameter Type Description
measurement String the name of the measurement (be careful about spelling errors)
value Number a numeric value for the measurement

Return values

None

import time;
time1 = time.time() * 1000.0
#
# ... do something time intensive
#
time2 = time.time() * 1000.0
Stats.push("timeToComplete", time2 - time1)
var time1 = (new Date()).getTime();
//
// ... do something time intensive
//
var time2 = (new Date()).getTime();
Stats.push("timeToComplete", time2 - time1);

Stats.tag

Works just like Stats.push above but allows for tagging measurements with additional metadata.

Stats.tag(measurement, value, tagName, tagValue)

Parameters

Parameter Type Description
measurement String the name of the measurement (be careful about spelling errors)
value Number a numeric value for the measurement
tagName String An additional tag for the measurement (may come handy for queries)
tagValue String A value associated with the tag

Return values

None

import time;
time1 = time.time() * 1000.0
#
# ... do something time intensive
#
time2 = time.time() * 1000.0
Stats.push("timeToComplete", time2 - time1, "symbol", "AMC")
var time1 = (new Date()).getTime();
//
// ... do something time intensive
//
var time2 = (new Date()).getTime();
Stats.push("timeToComplete", time2 - time1, "symbol", "AMC");