带黎曼的猎鹰监视器
Owl的Python项目详细描述
猫头鹰
测量您的Falcon请求需要多长时间 将每个度量作为事件发送到Riemann。
示例
owl被设计成api的混合类。要使用owl,您可以创建自己的 为owl提供配置参数的api类。
在python 3中,这可能看起来像这样:
fromfalcon.apiimportAPIfromriemann_client.clientimportQueuedClientfromowlimportOwlclassMonitoredAPI(Owl,API):def__init__(self,*args,**kwds):kwds["get_riemann_client"]=lambda:QueuedClient()kwds["owl_service"]="MyAPI"# service name for Riemannsuper().__init__(*args,**kwds)api=MonitoredAPI()# api.add_route(...)# ...
在riemann中,您将端点和请求结果状态代码作为标记。到 将它们转换为自己的InfluxDB标记( endpoint` and ``status-code)供以后使用(例如 Grafana)你可以在你的 riemann infloxdb配置:
(defn- parse-api-event[event](if (contains? event:tags)(let [[endpointstatus-code&other](:tagsevent)](assoc event:endpointendpoint:status-codestatus-code))event))(let [index (index)](streamsindex; Write API monitoring to database(where(service"MyAPI")#(info(parse-api-event%))(comp api-dbparse-api-event))))
如果要自定义事件,请签出event_builder参数 参数(例如,更改服务的含义或添加描述)。
安装
$ pip install owl
更改日志
0.2.0
- generate a message with status 500 when a request throws an exception