def patch(): if getattr(aiobotocore.client, '_opentelemetry_patch', False): return setattr(aiobotocore.client, '_opentelemetry_patch', True) wrapt.wrap_function_wrapper('aiobotocore.client', 'AioBaseClient._make_api_call', _wrapped_api_call) Pin(service='aws', app='aws', app_type='web').onto(aiobotocore.client.AioBaseClient)
def patch(): """Instrument Pylons applications""" if getattr(pylons.wsgiapp, '_opentelemetry_patch', False): return setattr(pylons.wsgiapp, '_opentelemetry_patch', True) wrapt.wrap_function_wrapper('pylons.wsgiapp', 'PylonsApp.__init__', traced_init)
def patch(): """Patch the bottle.Bottle class """ if getattr(bottle, '_opentelemetry_patch', False): return setattr(bottle, '_opentelemetry_patch', True) wrapt.wrap_function_wrapper('bottle', 'Bottle.__init__', traced_init)
def _patch_extensions(_extensions): # we must patch extensions all the time (it's pretty harmless) so split # from global patching of connections. must be idempotent. for _, module, func, wrapper in _extensions: if not hasattr(module, func) or isinstance(getattr(module, func), wrapt.ObjectProxy): continue wrapt.wrap_function_wrapper(module, func, wrapper)
def patch(): """ Patch falcon.API to include contrib.falcon.TraceMiddleware by default """ if getattr(falcon, '_opentelemetry_patch', False): return setattr(falcon, '_opentelemetry_patch', True) wrapt.wrap_function_wrapper('falcon', 'API.__init__', traced_init)
def patch(): """ Patch monkey patches psycopg's connection function so that the connection's functions are traced. """ if getattr(aiopg, '_opentelemetry_patch', False): return setattr(aiopg, '_opentelemetry_patch', True) wrapt.wrap_function_wrapper(aiopg.connection, '_connect', patched_connect) _patch_extensions(_aiopg_extensions) # do this early just in case
def patch(): """ AWSQueryConnection and AWSAuthConnection are two different classes called by different services for connection. For exemple EC2 uses AWSQueryConnection and S3 uses AWSAuthConnection """ if getattr(boto.connection, '_opentelemetry_patch', False): return setattr(boto.connection, '_opentelemetry_patch', True) wrapt.wrap_function_wrapper('boto.connection', 'AWSQueryConnection.make_request', patched_query_request) wrapt.wrap_function_wrapper('boto.connection', 'AWSAuthConnection.make_request', patched_auth_request) Pin(service='aws', app='aws', app_type='web').onto(boto.connection.AWSQueryConnection) Pin(service='aws', app='aws', app_type='web').onto(boto.connection.AWSAuthConnection)
def patch(): wrapt.wrap_function_wrapper('mysql.connector', 'connect', _connect) # `Connect` is an alias for `connect`, patch it too if hasattr(mysql.connector, 'Connect'): mysql.connector.Connect = mysql.connector.connect
def patch(): wrapt.wrap_function_wrapper('pymysql', 'connect', _connect)