-
Notifications
You must be signed in to change notification settings - Fork 61
Customize_Stats
Neuron Teckid edited this page May 3, 2016
·
1 revision
Override this function in RedisCtl
for statistics customization
# Create a client from config
# - config: the config passed to `RedisCtl` app
# by default it returns None
def init_stats_client(self, config)
The client returned from the above function should implement the following member functions
# query
# - addr: address of a Redis or proxy (in the form of `IP:PORT`)
# - fields: data fields, a dict object in a form of {field: aggregate-function}, where "field" is a field name like "cpu_usage_sys", "completed_commands", etc, and "aggregate-function" is one of "max", "min", "avg"
# - span: time span
# - now: the current time
# - interval: interval between every two data points
# return:
# a dict, each item of which is {field: points}, where each "points" is
# a list whose elements are tuples of (timestamp, value)
# it is fine when the values returned may not strictly conform the arguments, and the web will paint what is returned
def query(self, addr, fields, span, now, interval)
# write
# - addr: same as "addr" in "query"
# - points: a dict to write, whose items are in the form of {field: point-value}
def write_points(self, addr, points)