def monkey_patch(): from pinpoint.common import Interceptor from .PyRedisPlugins import PyRedisPlugins try: import redis Interceptors = [ Interceptor(redis, 'Redis', PyRedisPlugins), Interceptor(redis.Redis, 'execute_command', PyRedisPlugins) ] for interceptor in Interceptors: interceptor.enable() except ImportError as e: # do nothing print(e)
def monkey_patch(): try: import pymysql from pymysql.cursors import Cursor from .PyMysqlPlugin import PyMysqlPlugin # HookSet = [ # ('pymysql', 'connect', pymysql, pymysql.connect), # ('Cursor','execute', Cursor, Cursor.execute), # ('Cursor','fetchall', Cursor, Cursor.fetchall) # ] # # for hook in HookSet: # new_Cursor = PyMysqlPlugin(hook[0], '') # setattr(hook[2],hook[1], new_Cursor(hook[3])) Interceptors = [ # Interceptor(pymysql, 'connect', PyMysqlPlugin), Interceptor(Cursor, 'execute', PyMysqlPlugin), # Interceptor(Cursor, 'fetchall', PyMysqlPlugin) ] for interceptor in Interceptors: interceptor.enable() except ImportError as e: # do nothing print(e)
def monkey_patch(): from pinpoint.common import Interceptor try: import requests from .NextSpanPlugin import NextSpanPlugin Interceptors = [ Interceptor(requests.post, 'find', NextSpanPlugin), Interceptor(requests.get, 'insert', NextSpanPlugin), Interceptor(requests.patch, 'update', NextSpanPlugin), ] for interceptor in Interceptors: interceptor.enable() except ImportError: pass
def monkey_patch(): from pinpoint.common import Interceptor try: import requests from .NextSpanPlugin import NextSpanPlugin Interceptors = [ Interceptor(requests,'post', NextSpanPlugin), Interceptor(requests, 'get', NextSpanPlugin), Interceptor(requests, 'patch', NextSpanPlugin), ] for interceptor in Interceptors: interceptor.enable() except ImportError: pass
def monkey_patch(): try: from mysql.connector.cursor import MySQLCursor, MySQLCursorPrepared from mysql.connector.cursor_cext import CMySQLCursor, CMySQLCursorPrepared from .MysqlPlugin import MysqlPlugin from .CMysqlPlugin import CMysqlPlugin Interceptors = [ Interceptor(MySQLCursor, 'execute', MysqlPlugin), Interceptor(MySQLCursorPrepared, 'execute', MysqlPlugin), Interceptor(CMySQLCursor, 'execute', CMysqlPlugin), Interceptor(CMySQLCursorPrepared, 'execute', CMysqlPlugin), ] for interceptor in Interceptors: interceptor.enable() except ImportError as e: # do nothing print(e)
def monkey_patch(): try: import celery from celery.app.task import Task from celery.result import AsyncResult from .TaskPlugin import TaskPlugin from .GetPlugin import GetPlugin Interceptors = [ Interceptor(Task, 'delay', TaskPlugin), Interceptor(AsyncResult, 'get', GetPlugin), ] for interceptor in Interceptors: interceptor.enable() print('-------------------------------------------') except ImportError as e: # do nothing print(e)
def monkey_patch(): try: from MySQLdb.connections import Connection from .MysqldbPlugin import MysqldbPlugin Interceptors = [Interceptor(Connection, 'query', MysqldbPlugin)] for interceptor in Interceptors: interceptor.enable() except ImportError as e: print(e)
def monkey_patch(): from pinpoint.common import Interceptor try: from memcache import Client from .PyMemcachedPlugin import PyMemcachedPlugin Interceptors = [Interceptor(Client, '_get', PyMemcachedPlugin)] for interceptor in Interceptors: interceptor.enable() except ImportError as e: print(e)
def monkey_patch(): try: from .WorkerPlugin import WorkerPlugin from celery.app import trace Interceptors = [ Interceptor(trace, 'trace_task', WorkerPlugin), ] for interceptor in Interceptors: interceptor.enable() except ImportError as e: # do nothing print(e)
def monkey_patch(): try: from .WrapperTracer import WrapperTracer # from .WorkerTaskTracePlugin import WorkerTaskTracePlugin from celery.app import trace Interceptors = [ # Interceptor(trace, 'trace_task', WorkerTaskTracePlugin), Interceptor(trace, 'build_tracer', WrapperTracer), ] for interceptor in Interceptors: interceptor.enable() except ImportError as e: print(e)
def monkey_patch(): from pinpoint.common import Interceptor try: import urllib.request from .UrlOpenPlugin import UrlOpenPlugin Interceptors = [Interceptor(urllib.request, 'urlopen', UrlOpenPlugin)] for interceptor in Interceptors: interceptor.enable() except ImportError: pass
def monkey_patch(): try: from rest_framework.views import APIView from .ViewsPlugin import ViewsPlugin Interceptors = [ Interceptor(APIView, 'dispatch', ViewsPlugin), ] for interceptor in Interceptors: interceptor.enable() except ImportError as e: # do nothing print(e)
def monkey_patch(): from pinpoint.common import Interceptor try: from pymemcache.client.base import Client from .PymemcachePlugin import PymemcachePlugin Interceptors = [ Interceptor(Client,'_fetch_cmd', PymemcachePlugin) ] for interceptor in Interceptors: interceptor.enable() except ImportError as e: print(e)
def monkey_patch(): try: from kombu.messaging import Producer from .ProducerPlugin import ProducerPlugin Interceptors = [ Interceptor(Producer, 'publish', ProducerPlugin), ] for interceptor in Interceptors: interceptor.enable() except ImportError as e: # do nothing print(e)
def monkey_patch(): from pinpoint.common import Interceptor from .PyRedisPlugins import PyRedisPlugins try: from redis.connection import Connection Interceptors = [ Interceptor(Connection, 'send_command', PyRedisPlugins) ] for interceptor in Interceptors: interceptor.enable() except ImportError as e: # do nothing print(e)
def monkey_patch(): from pinpoint.common import Interceptor try: import amqp from .AmqpPlugin import AmqpPlugin Interceptors = [ Interceptor(amqp.Channel,'basic_publish_confirm', AmqpPlugin) ] for interceptor in Interceptors: interceptor.enable() except ImportError as e: print(e)
def monkey_patch(): try: import pymysql from pymysql.cursors import Cursor from .PyMysqlPlugin import PyMysqlPlugin Interceptors = [ Interceptor(Cursor, 'execute', PyMysqlPlugin), ] for interceptor in Interceptors: interceptor.enable() except ImportError as e: # do nothing print(e)
def monkey_patch(): try: from amqp.channel import Channel from .AMQPPublicPlugin import AMQPPublicPlugin # from .AMQPConsumerPlugin import AMQPConsumerPlugin Interceptors = [ Interceptor(Channel, 'basic_publish_confirm', AMQPPublicPlugin), # Interceptor(Channel, 'basic_consume', AMQPConsumerPlugin), ] for interceptor in Interceptors: interceptor.enable() except ImportError as e: # do nothing print(e)
def monkey_patch(): from pinpoint.common import Interceptor try: import pymongo from .MongoClientPlugin import MongoClientPlugin Interceptors = [ Interceptor(pymongo.collection, 'find', MongoClientPlugin), Interceptor(pymongo.collection, 'insert', MongoClientPlugin), Interceptor(pymongo.collection, 'update', MongoClientPlugin), Interceptor(pymongo.collection, 'update_many', MongoClientPlugin), Interceptor(pymongo.collection, 'delete_one', MongoClientPlugin), Interceptor(pymongo.collection, 'delete_many', MongoClientPlugin), Interceptor(pymongo.collection, 'insert_many', MongoClientPlugin), Interceptor(pymongo.collection, 'insert_one', MongoClientPlugin), ] for interceptor in Interceptors: interceptor.enable() except ImportError: pass
# distributed under the License is distributed on an "AS IS" BASIS, - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - # See the License for the specific language governing permissions and - # limitations under the License. - # ------------------------------------------------------------------------------ # Created by eeliu at 8/20/20 from pinpoint.common import Interceptor from .MongoClientPlugin import MongoClientPlugin try: from motor.core import AgnosticCollection Interceptors = [ Interceptor(AgnosticCollection, 'find', MongoClientPlugin), # Interceptor(AgnosticCollection, 'find_one', MongoClientPlugin), # Interceptor(AgnosticCollection, 'insert', MongoClientPlugin), # Interceptor(AgnosticCollection, 'update', MongoClientPlugin), # Interceptor(AgnosticCollection, 'update_many', MongoClientPlugin), # Interceptor(AgnosticCollection, 'delete_one', MongoClientPlugin), # Interceptor(AgnosticCollection, 'delete_many', MongoClientPlugin), # Interceptor(AgnosticCollection, 'insert_many', MongoClientPlugin), # Interceptor(AgnosticCollection, 'insert_one', MongoClientPlugin), ] for interceptor in Interceptors: interceptor.enable() except ImportError as e: print(e)