Exemplo n.º 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()
Exemplo n.º 2
0
 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()
Exemplo n.º 3
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()
Exemplo n.º 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()
Exemplo n.º 5
0
 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()
Exemplo n.º 6
0
    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()
Exemplo n.º 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()
Exemplo n.º 8
0
    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()
Exemplo n.º 9
0
    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()
Exemplo n.º 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()
Exemplo n.º 11
0
    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()
Exemplo n.º 12
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()