石墨/碳客户
graphiti的Python项目详细描述
graphiti是用于向graphite/carbon发送任何度量的python模块
生成状态:
功能
- 异步发送
- 将多个度量合并为单个数据包
- 使用pickle协议
- 处理临时网络中断
- gevent支架
安装
graphiti通过pip安装。
pip install graphiti
使用示例
示例:
from graphiti import Client client = Client(carbon_host) client.send("graphiti.server.cpu_usage", 12.4, timestamp) client.send("graphiti.server.cpu_usage", 15.1) # current time will be used project = "graphite" server = "server" client.send((project, server, "cpu_usage"), 11) # metric name is graphiti.server.cpu_usage # also you can aggregate values on client side from graphiti import Aggregator, timeit aggregator = Aggregator(client, interval=60) # aggregate metrics during minute aggregator.add_sum('processed_messages', 1) aggregator.add_avg('message_processing_avg_time', time_taken) aggregator.add_active('service_is_up') with timeit(aggregator, ["graphiti", "server", "messages"]): process_message() # send metrics graphiti.server.messages.time_avg -- average time of message processing # graphiti.server.messages.time_sum -- total time of message processing # graphiti.server.messages.count -- number of processed message per minute client.stop()
来源
graphiti源位于位桶:https://bitbucket.org/asdtech/graphiti