(method, args)
| 21 | |
| 22 | @cat.transaction("rpc", "server") |
| 23 | def 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 | |
| 40 | if __name__ == '__main__': |
no test coverage detected