Exemple #1
0
def instrument_gluon_compileapp(module):

    # Wrap the run_models_in() function as first phase
    # in executing a request after URL has been mapped
    # to a specific view. The name given to the web
    # transaction is combination of the application name
    # and view path.

    def transaction_name_run_models_in(environment):
        return '%s::%s' % (environment['request'].application,
                           environment['response'].view)

    wrap_transaction_name(module,
                          'run_models_in',
                          name=transaction_name_run_models_in,
                          group='Web2Py')

    # Wrap functions which coordinate the execution of
    # the separate models, controller and view phases of
    # the request handling. This is done for timing how
    # long taken within these phases of request
    # handling.

    def name_function_run_models_in(environment):
        return '%s/%s' % (environment['request'].controller,
                          environment['request'].function)

    wrap_function_trace(module,
                        'run_models_in',
                        name=name_function_run_models_in,
                        group='Python/Web2Py/Models')

    def name_function_run_controller_in(controller, function, environment):
        return '%s/%s' % (controller, function)

    wrap_function_trace(module,
                        'run_controller_in',
                        name=name_function_run_controller_in,
                        group='Python/Web2Py/Controller')

    def name_function_run_view_in(environment):
        return '%s/%s' % (environment['request'].controller,
                          environment['request'].function)

    wrap_function_trace(module,
                        'run_view_in',
                        name=name_function_run_view_in,
                        group='Python/Web2Py/View')
def instrument_openerp_http(module):

    # Wrap the correspond dispatch function for request.
    # At this point the url and function info has bind to an endpoint.
    # The name used as web transaction is the path to the function.
    def transaction_httprequest_dispatch(instance, *args, **kwargs):
        return '{0}:{1}'.format(callable_name(instance.endpoint.method),
                                instance.httprequest.method)

    wrap_transaction_name(module,
                          'HttpRequest.dispatch',
                          name=transaction_httprequest_dispatch,
                          group='Python/OpenERP')

    def transaction_jsonrequest_dispatch(instance, *args, **kwargs):
        return '{0}:{1}'.format(callable_name(instance.endpoint.method),
                                instance.httprequest.method)

    wrap_transaction_name(module,
                          'JsonRequest.dispatch',
                          name=transaction_jsonrequest_dispatch,
                          group='Python/OpenERP')

    # Wrap functions which coordinate the execution of the request
    # initial phase. This is for timing how long this phase take.
    # This phase only execute once.
    # NOTICE: this is not captured due to the unkown bug that some of the
    # first request data was not captured.
    wrap_function_trace(module, 'Root.load_addons', group='Fixture/Execute')

    # Wrap functions which coordinate the execution of the different phases
    # of the request handling. This is for timing how long these phases take.
    wrap_function_trace(module, 'Root.setup_session', group='Python/OpenERP')

    wrap_function_trace(module, 'Root.setup_db', group='Python/OpenERP')

    wrap_function_trace(module, 'Root.setup_lang', group='Python/OpenERP')

    wrap_function_trace(module,
                        'WebRequest._call_function',
                        group='Python/OpenERP')

    wrap_function_trace(module, 'Response.render', group='Python/OpenERP')
Exemple #3
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')
Exemple #4
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')
def instrument_django_contrib_staticfiles_handlers(module):
    wrap_transaction_name(module, 'StaticFilesHandler.serve')
Exemple #6
0
def instrument_django_contrib_staticfiles_handlers(module):
    wrap_transaction_name(module, 'StaticFilesHandler.serve')