예제 #1
0
def instrument_sqlite3_dbapi2(module):
    register_database_client(module,
                             'SQLite',
                             'single',
                             instance_name=instance_name)

    wrap_object(module, 'connect', ConnectionFactory, (module, ))
예제 #2
0
def instrument_psycopg2cffi(module):
    register_database_client(module, database_name='Postgres',
            quoting_style='single', explain_query='explain',
            explain_stmts=('select', 'insert', 'update', 'delete'),
            instance_name=instance_name)

    wrap_object(module, 'connect', ConnectionFactory, (module,))
예제 #3
0
def instrument_pymssql(module):
    # XXX Don't believe MSSQL provides a simple means of doing an
    # explain plan using one SQL statement prefix, eg., 'EXPLAIN'.

    register_database_client(module,
                             database_name='MSSQL',
                             quoting_style='single')

    wrap_object(module, 'connect', ConnectionFactory, (module, ))
예제 #4
0
def instrument_ibm_db_dbi(module):
    register_database_client(module,
                             database_name='IBMDB2',
                             quoting_style='single',
                             explain_query='EXPLAIN',
                             explain_stmts=('select', 'insert', 'update',
                                            'delete'))

    wrap_object(module, 'connect', ConnectionFactory, (module, ))
예제 #5
0
def instrument_postgresql_interface_proboscis_dbapi2(module):
    register_database_client(module, database_name='Postgres',
            quoting_style='single', explain_query='explain',
            explain_stmts=('select', 'insert', 'update', 'delete'),
            instance_name=instance_name)

    from .database_dbapi2 import ConnectionFactory

    wrap_object(module, 'connect', ConnectionFactory, (module,))
예제 #6
0
def instrument_tornado_mysql(module):
    register_database_client(module,
                             database_name='MySQL',
                             quoting_style='single+double',
                             explain_query='explain',
                             explain_stmts=('select', ),
                             instance_name=instance_name)

    wrap_object(module.connections, 'Connection', ConnectionFactory,
                (module, ))
예제 #7
0
def instrument_psycopg2ct(module):
    register_database_client(module,
                             database_name='Postgres',
                             quoting_style='single',
                             explain_query='explain',
                             explain_stmts=('select', 'insert', 'update',
                                            'delete'),
                             instance_name=instance_name)

    wrap_object(module, 'connect', ConnectionFactory, (module, ))
예제 #8
0
def instrument_postgresql_interface_proboscis_dbapi2(module):
    register_database_client(module,
                             database_name='Postgres',
                             quoting_style='single',
                             explain_query='explain',
                             explain_stmts=('select', 'insert', 'update',
                                            'delete'),
                             instance_name=instance_name)

    from .database_dbapi2 import ConnectionFactory

    wrap_object(module, 'connect', ConnectionFactory, (module, ))
예제 #9
0
def instrument_sqlite3(module):
    # This case is to handle where the sqlite3 module was already
    # imported prior to agent initialization. In this situation, a
    # reference to the connect() method would already have been created
    # which referred to the uninstrumented version of the function
    # originally imported by sqlite3.dbapi2 before instrumentation could
    # be applied.

    if not isinstance(module.connect, ConnectionFactory):
        register_database_client(module, 'SQLite', instance_name=instance_name)

        wrap_object(module, 'connect', ConnectionFactory, (module, ))
예제 #10
0
def instrument_sqlite3(module):
    # This case is to handle where the sqlite3 module was already
    # imported prior to agent initialization. In this situation, a
    # reference to the connect() method would already have been created
    # which referred to the uninstrumented version of the function
    # originally imported by sqlite3.dbapi2 before instrumentation could
    # be applied.

    if not isinstance(module.connect, ConnectionFactory):
        register_database_client(module, 'SQLite',
                instance_name=instance_name)

        wrap_object(module, 'connect', ConnectionFactory, (module,))
예제 #11
0
def instrument_pymysql(module):
    register_database_client(module, database_name='MySQL',
            quoting_style='single+double', explain_query='explain',
            explain_stmts=('select',), instance_name=instance_name)

    wrap_object(module, 'connect', ConnectionFactory, (module,))

    # The connect() function is actually aliased with Connect() and
    # Connection, the later actually being the Connection type object.
    # Instrument Connect(), but don't instrument Connection in case that
    # interferes with direct type usage. If people are using the
    # Connection object directly, they should really be using connect().

    if hasattr(module, 'Connect'):
        wrap_object(module, 'Connect', ConnectionFactory, (module,))
예제 #12
0
def instrument_mysql_connector(module):
    register_database_client(module,
                             database_name='MySQL',
                             quoting_style='single+double',
                             explain_query='explain',
                             explain_stmts=('select', ),
                             instance_name=instance_name)

    wrap_object(module, 'connect', ConnectionFactory, (module, ))

    # The connect() function is actually aliased with Connect() and
    # Connection, the later actually being the Connection type object.
    # Instrument Connect(), but don't instrument Connection in case that
    # interferes with direct type usage. If people are using the
    # Connection object directly, they should really be using connect().

    if hasattr(module, 'Connect'):
        wrap_object(module, 'Connect', ConnectionFactory, (module, ))
예제 #13
0
def instrument(module):

    if module.__name__ == 'pylons.wsgiapp':
        wrap_error_trace(module, 'PylonsApp.__call__')

    elif module.__name__ == 'pylons.controllers.core':
        wrap_transaction_name(module, 'WSGIController.__call__', name_controller)
        wrap_function_trace( module, 'WSGIController.__call__')

        def name_WSGIController_perform_call(self, func, args):
            return callable_name(func)

        wrap_function_trace(module, 'WSGIController._perform_call',
                            name_WSGIController_perform_call)
        wrap_object(module, 'WSGIController._perform_call', capture_error)

    elif module.__name__ == 'pylons.templating':

        wrap_function_trace(module, 'render_genshi')
        wrap_function_trace(module, 'render_mako')
        wrap_function_trace(module, 'render_jinja2')
예제 #14
0
def instrument(module):

    if module.__name__ == 'pylons.wsgiapp':
        wrap_error_trace(module, 'PylonsApp.__call__')

    elif module.__name__ == 'pylons.controllers.core':
        wrap_transaction_name(module, 'WSGIController.__call__',
                              name_controller)
        wrap_function_trace(module, 'WSGIController.__call__')

        def name_WSGIController_perform_call(self, func, args):
            return callable_name(func)

        wrap_function_trace(module, 'WSGIController._perform_call',
                            name_WSGIController_perform_call)
        wrap_object(module, 'WSGIController._perform_call', capture_error)

    elif module.__name__ == 'pylons.templating':

        wrap_function_trace(module, 'render_genshi')
        wrap_function_trace(module, 'render_mako')
        wrap_function_trace(module, 'render_jinja2')
예제 #15
0
def instrument_gluon_main(module):

    wrap_wsgi_application(module, 'wsgibase')

    # Wrap main function which dispatches the various
    # phases of a request in order to capture any
    # errors. Need to use a custom object wrapper as we
    # need to ignore exceptions of type HTTP as that
    # type of exception is used to programmatically
    # return a valid response. For the case of a 404,
    # where we want to name the web transactions as
    # such, we pick that up later.

    class error_serve_controller(object):
        def __init__(self, wrapped):
            update_wrapper(self, wrapped)
            self._bw_next_object = wrapped
            if not hasattr(self, '_bw_last_object'):
                self._bw_last_object = wrapped

        def __call__(self, request, response, session):
            txn = current_transaction()
            if txn:
                HTTP = import_module('gluon.http').HTTP
                try:
                    return self._bw_next_object(request, response, session)
                except HTTP:
                    raise
                except:  # Catch all
                    txn.record_exception(*sys.exc_info())
                    raise
            else:
                return self._bw_next_object(request, response, session)

        def __getattr__(self, name):
            return getattr(self._bw_next_object, name)

    wrap_object(module, 'serve_controller', error_serve_controller)
예제 #16
0
def instrument(module):

    if module.__name__ == 'genshi.template.base':

        wrap_object(module, 'Template.generate', wrap_template)
예제 #17
0
def instrument(module):

    if module.__name__ == 'genshi.template.base':

        wrap_object(module, 'Template.generate', wrap_template)
예제 #18
0
def instrument_mako_runtime(module):

    wrap_object(module, '_render', TemplateRenderWrapper)
예제 #19
0
def instrument(module):
    wrap_object(module, 'parse', capture_external_trace)
예제 #20
0
def instrument_sqlite3_dbapi2(module):
    register_database_client(module, 'SQLite', 'single',
            instance_name=instance_name)

    wrap_object(module, 'connect', ConnectionFactory, (module,))
예제 #21
0
def instrument_cx_oracle(module):
    register_database_client(module, database_name='Oracle',
            quoting_style='single')

    wrap_object(module, 'connect', ConnectionFactory, (module,))
예제 #22
0
def instrument(module):
    wrap_object(module, 'parse', capture_external_trace)
예제 #23
0
def instrument(module):
    register_database_client(module, 'DBAPI2', 'single')

    wrap_object(module, 'connect', ConnectionFactory, (module,))
예제 #24
0
def instrument_tornado_mysql(module):
    register_database_client(module, database_name='MySQL',
            quoting_style='single+double', explain_query='explain',
            explain_stmts=('select',), instance_name=instance_name)

    wrap_object(module.connections, 'Connection', ConnectionFactory, (module,))
예제 #25
0
def instrument_ibm_db_dbi(module):
    register_database_client(module, database_name='IBMDB2',
            quoting_style='single', explain_query='EXPLAIN',
            explain_stmts=('select', 'insert', 'update', 'delete'))

    wrap_object(module, 'connect', ConnectionFactory, (module,))
예제 #26
0
def instrument_piston_resource(module):

    wrap_object(module, 'Resource.__init__', ResourceInitWrapper)