コード例 #1
0
    def run(self):
        self.set_wrapped({
            'elasticsearch.client.Elasticsearch.create':
            get_complex_wrapper('data.es.create.',
                                state='data.elasticsearch',
                                disable_if='model'),
            'elasticsearch.client.Elasticsearch.get':
            get_complex_wrapper('data.es.get.',
                                state='data.elasticsearch',
                                disable_if='model'),
            'elasticsearch.client.Elasticsearch.index':
            get_complex_wrapper('data.es.index.',
                                state='data.elasticsearch',
                                disable_if='model'),
            'elasticsearch.client.Elasticsearch.search':
            get_complex_wrapper('data.es.search.',
                                state='data.elasticsearch',
                                disable_if='model'),
            'elasticsearch.client.Elasticsearch.delete':
            get_complex_wrapper('data.es.delete.',
                                state='data.elasticsearch',
                                disable_if='model'),
        })

        super(ElasticsearchInstrumentor, self).run()
コード例 #2
0
ファイル: pykafka.py プロジェクト: librato/librato-python-web
 def run(self):
     self.set_wrapped(
         {
             # Kafka (pykafka)
             'pykafka.simpleconsumer.SimpleConsumer.consume':
                 get_complex_wrapper('messaging.kafka.consume.', state='messaging.kafka', disable_if='model'),
             'pykafka.Producer.produce':
                 get_complex_wrapper('messaging.kafka.produce.', state='messaging.kafka', disable_if='model'),
         })
     super(PykafkaInstrumentor, self).run()
コード例 #3
0
ファイル: mysqldb.py プロジェクト: librato/librato-python-web
 def run(self):
     self.set_wrapped(
         {
             'MySQLdb.cursors.Cursor.execute':
                 get_complex_wrapper('data.mysql.execute.', state='data.mysql', disable_if='model'),
             'MySQLdb.cursors.Cursor.callproc':
                 get_complex_wrapper('data.mysql.callproc.', state='data.mysql', disable_if='model'),
         }
     )
     super(MysqlInstrumentor, self).run()
コード例 #4
0
 def run(self):
     self.set_wrapped({
         'MySQLdb.cursors.Cursor.execute':
         get_complex_wrapper('data.mysql.execute.',
                             state='data.mysql',
                             disable_if='model'),
         'MySQLdb.cursors.Cursor.callproc':
         get_complex_wrapper('data.mysql.callproc.',
                             state='data.mysql',
                             disable_if='model'),
     })
     super(MysqlInstrumentor, self).run()
コード例 #5
0
ファイル: pykafka.py プロジェクト: cpdean/librato-python-web
 def run(self):
     self.set_wrapped({
         # Kafka (pykafka)
         'pykafka.simpleconsumer.SimpleConsumer.consume':
         get_complex_wrapper('messaging.kafka.consume.',
                             state='messaging.kafka',
                             disable_if='model'),
         'pykafka.Producer.produce':
         get_complex_wrapper('messaging.kafka.produce.',
                             state='messaging.kafka',
                             disable_if='model'),
     })
     super(PykafkaInstrumentor, self).run()
コード例 #6
0
ファイル: django_.py プロジェクト: librato/librato-python-web
    def run(self):
        wrappers = {
            "django.db.models.query.QuerySet.iterator": get_generator_wrapper(
                generate_record_telemetry("model.iterator."), state="model"
            )
        }

        _query_set_methods = [
            "aggregate",
            "count",
            "bulk_create",
            "create",
            "get",
            "get_or_create",
            "latest",
            "first",
            "last",
            "in_bulk",
            "iterator",
            "update_or_create",
            "delete",
            "update",
            "exists",
        ]

        for method in _query_set_methods:
            metric = "model." + method
            wrappers["django.db.models.query.QuerySet." + method] = get_complex_wrapper(metric, state="model")

        self.set_wrapped(wrappers)
        super(DjangoDbInstrumentor, self).run()
コード例 #7
0
    def run(self):
        self.set_wrapped(
            {
                'elasticsearch.client.Elasticsearch.create':
                    get_complex_wrapper('data.es.create.', state='data.elasticsearch', disable_if='model'),
                'elasticsearch.client.Elasticsearch.get':
                    get_complex_wrapper('data.es.get.', state='data.elasticsearch', disable_if='model'),
                'elasticsearch.client.Elasticsearch.index':
                    get_complex_wrapper('data.es.index.', state='data.elasticsearch', disable_if='model'),
                'elasticsearch.client.Elasticsearch.search':
                    get_complex_wrapper('data.es.search.', state='data.elasticsearch', disable_if='model'),
                'elasticsearch.client.Elasticsearch.delete':
                    get_complex_wrapper('data.es.delete.', state='data.elasticsearch', disable_if='model'),
            }
        )

        super(ElasticsearchInstrumentor, self).run()
コード例 #8
0
ファイル: sqlite.py プロジェクト: librato/librato-python-web
    def run(self):
        # Instrument our wrapper connection class
        meths = {
            'librato_python_web.instrumentor.data.sqlite.WrappedCursor.' + m:
                get_complex_wrapper('data.sqlite.%s.' % m, state='data.sqlite', disable_if='model')

            for m in ['execute', 'executemany', 'fetchone', 'fetchmany', 'fetchall']
        }

        # Instrument connect method
        meths['sqlite3.connect'] = wrapped_connect

        self.set_wrapped(meths)
        super(SqliteInstrumentor, self).run()
コード例 #9
0
ファイル: sqlite.py プロジェクト: cpdean/librato-python-web
    def run(self):
        # Instrument our wrapper connection class
        meths = {
            'librato_python_web.instrumentor.data.sqlite.WrappedCursor.' + m:
            get_complex_wrapper('data.sqlite.%s.' % m,
                                state='data.sqlite',
                                disable_if='model')
            for m in
            ['execute', 'executemany', 'fetchone', 'fetchmany', 'fetchall']
        }

        # Instrument connect method
        meths['sqlite3.connect'] = wrapped_connect

        self.set_wrapped(meths)
        super(SqliteInstrumentor, self).run()
コード例 #10
0
    def run(self):
        """ Instruments our cursor wrapper class and psycopg2.connect """

        # Generate a list of methods in the cursor wrapper
        meth_names = [n for (n, _) in inspect.getmembers(WrappedCursor) if '_' not in n]

        meths = {
            'librato_python_web.instrumentor.data.psycopg2.WrappedCursor.' + m:
                get_complex_wrapper('data.psycopg2.%s.' % m, state='data.psycopg2', disable_if='model')
            for m in meth_names
           }

        # Instrument connect method
        meths['psycopg2.connect'] = wrapped_connect

        self.set_wrapped(meths)
        super(Psycopg2Instrumentor, self).run()
コード例 #11
0
ファイル: django_.py プロジェクト: cpdean/librato-python-web
    def run(self):
        wrappers = {
            'django.db.models.query.QuerySet.iterator':
            get_generator_wrapper(generate_record_telemetry('model.iterator.'),
                                  state='model'),
        }

        _query_set_methods = [
            'aggregate', 'count', 'bulk_create', 'create', 'get',
            'get_or_create', 'latest', 'first', 'last', 'in_bulk', 'iterator',
            'update_or_create', 'delete', 'update', 'exists'
        ]

        for method in _query_set_methods:
            metric = 'model.' + method
            wrappers['django.db.models.query.QuerySet.' +
                     method] = get_complex_wrapper(metric, state='model')

        self.set_wrapped(wrappers)
        super(DjangoDbInstrumentor, self).run()
コード例 #12
0
ファイル: psycopg2.py プロジェクト: cpdean/librato-python-web
    def run(self):
        """ Instruments our cursor wrapper class and psycopg2.connect """

        # Generate a list of methods in the cursor wrapper
        meth_names = [
            n for (n, _) in inspect.getmembers(WrappedCursor) if '_' not in n
        ]

        meths = {
            'librato_python_web.instrumentor.data.psycopg2.WrappedCursor.' + m:
            get_complex_wrapper('data.psycopg2.%s.' % m,
                                state='data.psycopg2',
                                disable_if='model')
            for m in meth_names
        }

        # Instrument connect method
        meths['psycopg2.connect'] = wrapped_connect

        self.set_wrapped(meths)
        super(Psycopg2Instrumentor, self).run()