def tracer(): tracer = Tracer(service_name='test-tracer', sampler=ConstSampler(True), reporter=InMemoryReporter(), scope_manager=TornadoScopeManager()) opentracing.set_global_tracer(tracer) try: yield tracer finally: opentracing._reset_global_tracer() tracer.close()
def tracer(): reporter = InMemoryReporter() report_func = reporter.report_span def log_and_report(span): print(('Reporting span %s' % span)) print(('Span type %s' % type(span))) print(('SpanContext type %s' % type(span.context))) report_func(span) reporter.report_span = log_and_report tracer = Tracer( service_name='test-tracer', sampler=ConstSampler(True), reporter=reporter, scope_manager=TornadoScopeManager() ) opentracing.set_global_tracer(tracer) try: yield tracer finally: opentracing._reset_global_tracer() tracer.close()
def teardown_function(function): opentracing._reset_global_tracer()