def test_trace_unpatch(self): # the application must not be traced if unpatch() is called patch() unpatch() response = self.fetch('/success/') eq_(200, response.code) traces = self.tracer.writer.pop_traces() eq_(0, len(traces))
def test_trace_unpatch(self): # the application must not be traced if unpatch() is called patch() unpatch() response = self.fetch('/success/') assert 200 == response.code traces = self.tracer.writer.pop_traces() assert 0 == len(traces)
def test_trace_app_twice(self): # the application must not be traced multiple times patch() patch() response = self.fetch('/success/') eq_(200, response.code) traces = self.tracer.writer.pop_traces() eq_(1, len(traces)) eq_(1, len(traces[0]))
def test_trace_app_twice(self): # the application must not be traced multiple times patch() patch() response = self.fetch('/success/') assert 200 == response.code traces = self.tracer.writer.pop_traces() assert 1 == len(traces) assert 1 == len(traces[0])
def get_app(self): # patch Tornado and reload module app patch() reload_module(compat) reload_module(app) settings = self.get_settings() trace_settings = settings.get('datadog_trace', {}) settings['datadog_trace'] = trace_settings trace_settings['tracer'] = self.tracer self.app = app.make_app(settings=settings) return self.app
def get_app(self): # patch Tornado and reload module app patch() reload_module(app) # create a dummy tracer and a Tornado web application self.tracer = get_dummy_tracer() settings = self.get_settings() trace_settings = settings.get('datadog_trace', {}) settings['datadog_trace'] = trace_settings trace_settings['tracer'] = self.tracer self.app = app.make_app(settings=settings) return self.app
def get_app(self): # patch Tornado and reload module app patch() compat.reload_module(compat) compat.reload_module(app) # create a dummy tracer and a Tornado web application self.tracer = get_dummy_tracer() settings = self.get_settings() trace_settings = settings.get('datadog_trace', {}) settings['datadog_trace'] = trace_settings trace_settings['tracer'] = self.tracer self.app = app.make_app(settings=settings) return self.app