def _complete_get(self): self.ziggy.start() with ziggy.Context('request.extra'): ziggy.set('continue_id', self.ziggy.id) self.write("Hello, world") self.finish()
def get(self): loop = tornado.ioloop.IOLoop.instance() req_id = self.ziggy.id called = yield tornado.gen.Task(loop.add_timeout, time.time() + random.randint(1, 5)) with ziggy.Context('request.extra'): ziggy.set('continue_id', req_id) self.write("Hello, world") self.finish()
def finish(self, *args, **kwargs): res = super(SampleRequestHandler, self).finish(*args, **kwargs) ziggy.set('response_status_code', self._status_code) return res
def write_error(self, status_code, **kwargs): if 'exc_info' in kwargs: ziggy.set('exception', ''.join(traceback.format_exception(*kwargs["exc_info"]))) return super(SampleRequestHandler, self).write_error(status_code, **kwargs)
def prepare(self): ziggy.set('headers', self.request.headers) ziggy.set('method', self.request.method) ziggy.set('uri', self.request.uri)
def test(self): ziggy.set('foo', True)
def test(self): with ziggy.Context('test', 5): ziggy.set('foo', True)