def uninstrument(): logging = utils.get_module('logging') if not utils.is_instrumented(logging): return utils.revert_wrapper(logging, 'Logger.makeRecord') utils.mark_uninstrumented(logging)
def uninstrument(): falcon = utils.get_module("falcon") if not utils.is_instrumented(falcon): return utils.revert_wrapper(falcon.API, "__init__") utils.mark_uninstrumented(falcon)
def uninstrument(): """Will only prevent new clients from registering tracers.""" redis = utils.get_module('redis') if not utils.is_instrumented(redis): return from redis.client import StrictRedis utils.revert_wrapper(StrictRedis, '__init__') utils.mark_uninstrumented(redis)
def uninstrument(): """ Will only prevent new Connections from registering tracers. It's not reasonably feasible to unwrap existing ConnectionTracing instances """ psycopg2 = utils.get_module('psycopg2') if not utils.is_instrumented(psycopg2): return utils.revert_wrapper(psycopg2, 'connect') utils.mark_uninstrumented(psycopg2)
def uninstrument(): """ Will only prevent new applications from registering tracers. It's not reasonably feasible to remove existing before/after_request trace methods of existing apps. """ flask = utils.get_module('flask') if not utils.is_instrumented(flask): return utils.revert_wrapper(flask.Flask, '__init__') utils.mark_uninstrumented(flask)
def uninstrument(): """ Will only prevent new applications from registering tracers. It's not reasonably feasible to remove existing before/after_request trace methods of existing apps. """ bottle = utils.get_module('bottle') if not utils.is_instrumented(bottle): return utils.revert_wrapper(bottle, 'run') utils.mark_uninstrumented(bottle)
def uninstrument(): """ Will only prevent new clients from registering tracers. It's not reasonably feasible to remove existing before/after_request trace methods of existing clients. """ pymongo = utils.get_module('pymongo') if not utils.is_instrumented(pymongo): return utils.revert_wrapper(pymongo.MongoClient, '__init__') utils.mark_uninstrumented(pymongo)
def test_revert_wrapper(): class Namespace(): def wrappee(self, *args, **kwargs): return 'wrappee' def wrapper(self, *args, **kwargs): return 'wrapper' wrap_function_wrapper(Namespace, 'wrappee', wrapper) assert Namespace().wrappee() == 'wrapper' utils.revert_wrapper(Namespace, 'wrappee') assert Namespace().wrappee() == 'wrappee'
def uninstrument(): requests = utils.get_module('requests') if not utils.is_instrumented(requests): return from requests_opentracing import SessionTracing if _session_tracing_new[0] is not None: if hasattr(_session_tracing_new[0], '__get__'): SessionTracing.__new__ = _session_tracing_new[0].__get__(SessionTracing) else: # builtin doesn't follow descriptor protocol SessionTracing.__new__ = _session_tracing_new[0] if _session_new[0] is not None: if hasattr(_session_new[0], '__get__'): requests.Session.__new__ = _session_new[0].__get__(requests.Session) else: requests.Session.__new__ = _session_new[0] utils.revert_wrapper(SessionTracing, '__init__') utils.mark_uninstrumented(requests)
def uninstrument(): celery = utils.get_module('celery') if not utils.is_instrumented(celery): return import celery.app from celery_opentracing import CeleryTracing if _celery_tracing_new[0] is not None: if hasattr(_celery_tracing_new[0], '__get__'): CeleryTracing.__new__ = _celery_tracing_new[0].__get__( CeleryTracing) else: # builtin doesn't follow descriptor protocol CeleryTracing.__new__ = _celery_tracing_new[0] if _celery_new[0] is not None: if hasattr(_celery_new[0], '__get__'): celery.app.base.Celery.__new__ = _celery_new[0].__get__( celery.Celery) else: celery.app.base.Celery.__new__ = _celery_new[0] utils.revert_wrapper(CeleryTracing, '__init__') utils.mark_uninstrumented(celery)