MCPcopy Create free account
hub / github.com/dianping/cat / serve

Function serve

lib/python/test/test_all.py:23–37  ·  view source on GitHub ↗
(method, args)

Source from the content-addressed store, hash-verified

21
22@cat.transaction("rpc", "server")
23def serve(method, args):
24 cat.log_event("hook", "receive")
25 with cat.Transaction("serve", method) as t:
26 try:
27 t.add_data(json.dumps(args))
28 t.add_data("foo", "bar")
29 cat.log_event("hook", "before1")
30 cat.log_event("hook", "before2")
31 cat.log_event("hook", "before3")
32 res = func(method, args)
33 finally:
34 cat.metric("rpc-count").count()
35 cat.metric("rpc-duration").duration(100)
36 cat.log_event("hook", "after")
37 return res
38
39
40if __name__ == '__main__':

Callers 1

test_all.pyFile · 0.85

Calls 7

log_eventMethod · 0.80
TransactionMethod · 0.80
metricMethod · 0.80
funcFunction · 0.70
countMethod · 0.65
durationMethod · 0.65
add_dataMethod · 0.45

Tested by

no test coverage detected