本文整理匯總了Python中datalogger.DataLogger.get_tsastats_longtime_hc方法的典型用法代碼示例。如果您正苦於以下問題:Python DataLogger.get_tsastats_longtime_hc方法的具體用法?Python DataLogger.get_tsastats_longtime_hc怎麽用?Python DataLogger.get_tsastats_longtime_hc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類datalogger.DataLogger
的用法示例。
在下文中一共展示了DataLogger.get_tsastats_longtime_hc方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_longtime_data
# 需要導入模塊: from datalogger import DataLogger [as 別名]
# 或者: from datalogger.DataLogger import get_tsastats_longtime_hc [as 別名]
def get_longtime_data(self, args):
"""
get values from RAW Archive
parameters:
/<str>project/<str>tablename/<str>datestring/<str>key/<str>value_keys
keyids=hostname:srvszp2orb.tilak.cc means
this is only useful if keyids are unique
return data like this:
[
{
name: "name of this series" usually this is the counter name
data : [[ts, value], ...]
},
...
]
"""
assert len(args) == 5
project, tablename, monthstring, keys_str, value_key = args
if len(monthstring) > 7:
return "monthstring, has to be in YYYY-MM format"
# key_str should be a tuple string, convert to unicode tuple
keys = tuple([unicode(key_value) for key_value in eval(base64.b64decode(keys_str))])
logging.info("project : %s", project)
logging.info("tablename : %s", tablename)
logging.info("monthstring : %s", monthstring)
logging.info("keys : %s", keys)
logging.info("value_keys : %s", value_key)
datalogger = DataLogger(basedir, project, tablename)
data = datalogger.get_tsastats_longtime_hc(monthstring, keys, value_key)
#logging.info("got data: %s", data)
hc_data = [{"name" : funcname, "data" : data[funcname]} for funcname in data.keys()]
return json.dumps(hc_data)