允许在后台线程中提交librato事件
librato_bg的Python项目详细描述
允许在后台线程中提交librato事件。沉重的 灵感来自segment.io的python库,它也有同样的功能。
用法
fromlibrato_bgimportClient# initialize with Librato API tokensclient=Client(username,token)# track as your normally would, params are event, value and source.# This is non-blocking, submission will take place in other threadclient.gauge('user_clicked',1,'prod')# when exiting, flush to join threads and make sure everything is sentclient.join()