def serve(method, args): cat.log_event("hook", "receive") with cat.Transaction("serve", method) as t: try: t.add_data(json.dumps(args)) cat.log_event("hook", "before1") cat.log_event("hook", "before2") cat.log_event("hook", "before3") res = func(method, args) finally: cat.metric("rpc-count").count() cat.metric("rpc-duration").duration(100) cat.log_event("hook", "after") return res
def test1(): cat.metric("metric1").count()
def test5(): cat.metric("metric4").add_tag( "color", "red").add_tag("category", "hat").count() cat.metric("metric4").add_tag("color", "red").add_tag( "category", "glass").count()
def test4(): cat.metric("metric3").add_tag("color", "red").count() cat.metric("metric3").add_tag("color", "yellow").count() cat.metric("metric3").add_tag("color", "blue").count()
def test3(): cat.metric("metric2").duration(152)
def test2(): cat.metric("metric1").count(2)
def test5(): cat.metric("metric4").add_tag("color", "red").add_tag("category", "hat").count() cat.metric("metric4").add_tag("color", "red").add_tag("category", "glass").count()