def call(self, module, method, wrapped, instance, args, kwargs): name = getattr(instance, 'name', None) if not name: name = '<template string>' with trace(name, "template.django"): return wrapped(*args, **kwargs)
def call(self, module, method, wrapped, instance, args, kwargs): if 'method' in kwargs: method = kwargs['method'] else: method = args[0] if 'url' in kwargs: url = kwargs['url'] else: url = args[1] signature = method.upper() if url: parsed_url = urlparse.urlparse(url) host = parsed_url.hostname or " " signature += " " + host if parsed_url.port and \ default_ports.get(parsed_url.scheme) != parsed_url.port: signature += ":" + str(parsed_url.port) with trace(signature, "ext.http.requests", {'url': url}, leaf=True): return wrapped(*args, **kwargs)
def test_redis_client(self, should_collect): should_collect.return_value = False self.client.begin_transaction("transaction.test") with trace("test_redis_client", "test"): conn = redis.StrictRedis() conn.rpush("mykey", "a", "b") conn.expire("mykey", 1000) self.client.end_transaction("MyView") transactions = self.client.instrumentation_store.get_all() traces = transactions[0]['traces'] expected_signatures = [ 'transaction', 'test_redis_client', 'RPUSH', 'EXPIRE' ] self.assertEqual(set([t['name'] for t in traces]), set(expected_signatures)) self.assertEqual(traces[0]['name'], 'RPUSH') self.assertEqual(traces[0]['type'], 'cache.redis') self.assertEqual(traces[1]['name'], 'EXPIRE') self.assertEqual(traces[1]['type'], 'cache.redis') self.assertEqual(traces[2]['name'], 'test_redis_client') self.assertEqual(traces[2]['type'], 'test') self.assertEqual(traces[3]['name'], 'transaction') self.assertEqual(traces[3]['type'], 'transaction') self.assertEqual(len(traces), 4)
def test_pipeline(self, should_collect): should_collect.return_value = False self.client.begin_transaction("transaction.test") with trace("test_pipeline", "test"): conn = redis.StrictRedis() pipeline = conn.pipeline() pipeline.rpush("mykey", "a", "b") pipeline.expire("mykey", 1000) pipeline.execute() self.client.end_transaction("MyView") transactions = self.client.instrumentation_store.get_all() traces = transactions[0]['traces'] expected_signatures = [ 'transaction', 'test_pipeline', 'StrictPipeline.execute' ] self.assertEqual(set([t['name'] for t in traces]), set(expected_signatures)) self.assertEqual(traces[0]['name'], 'StrictPipeline.execute') self.assertEqual(traces[0]['type'], 'cache.redis') self.assertEqual(traces[1]['name'], 'test_pipeline') self.assertEqual(traces[1]['type'], 'test') self.assertEqual(traces[2]['name'], 'transaction') self.assertEqual(traces[2]['type'], 'transaction') self.assertEqual(len(traces), 3)
def test_urllib3(self, should_collect): should_collect.return_value = False self.client.begin_transaction("transaction") expected_sig = 'GET localhost:{0}'.format(self.port) with trace("test_pipeline", "test"): pool = urllib3.PoolManager(timeout=0.1) url = 'http://localhost:{0}/hello_world'.format(self.port) r = pool.request('GET', url) self.client.end_transaction("MyView") transactions = self.client.instrumentation_store.get_all() traces = transactions[0]['traces'] expected_signatures = ['transaction', 'test_pipeline', expected_sig] self.assertEqual(set([t['name'] for t in traces]), set(expected_signatures)) self.assertEqual(len(traces), 3) self.assertEqual(traces[0]['name'], expected_sig) self.assertEqual(traces[0]['type'], 'ext.http.urllib3') self.assertEqual(traces[0]['context']['url'], url) self.assertEqual(traces[0]['parent'], 1) self.assertEqual(traces[1]['name'], 'test_pipeline') self.assertEqual(traces[1]['type'], 'test') self.assertEqual(traces[2]['name'], 'transaction') self.assertEqual(traces[2]['type'], 'transaction')
def call(self, module, method, wrapped, instance, args, kwargs): signature = ".".join([module, method]) if len(args) == 1: signature += " " + str(args[0]) with trace(signature, "db.sqlite.connect"): return SQLiteConnectionProxy(wrapped(*args, **kwargs))
def call(self, module, method, wrapped, instance, args, kwargs): if len(args) > 0: wrapped_name = str(args[0]) else: wrapped_name = self.get_wrapped_name(wrapped, instance, method) with trace(wrapped_name, "cache.redis", leaf=True): return wrapped(*args, **kwargs)
def test_lru_get_frames_cache(self): self.requests_store.transaction_start(None, "transaction.test") for i in range(10): with trace("bleh", "custom"): time.sleep(0.01) self.assertEqual(self.mock_get_frames.call_count, 1)
def _trace_sql(self, method, sql, params): signature = self.extract_signature(sql) kind = "db.{0}.sql".format(self.provider_name) with trace(signature, kind, {"sql": sql}): if params is None: return method(sql) else: return method(sql, params)
def test_requests_instrumentation(self, _): self.client.begin_transaction("transaction.test") with trace("test_pipeline", "test"): requests.get('http://example.com') self.client.end_transaction("MyView") _, traces = self.client.instrumentation_store.get_all() self.assertIn('GET example.com', map(lambda x: x['signature'], traces))
def test_lru_get_frames_cache(self): self.requests_store.begin_transaction("transaction.test") for i in range(10): with trace("bleh", "custom"): time.sleep(0.01) self.assertEqual(self.mock_get_frames.call_count, 1)
def call(self, module, method, wrapped, instance, args, kwargs): if 'request' in kwargs: request = kwargs['request'] else: request = args[0] signature = request.method.upper() signature += " " + get_host_from_url(request.url) with trace(signature, "ext.http.requests", {'url': request.url}, leaf=True): return wrapped(*args, **kwargs)
def test_leaf_tracing(self): self.requests_store.transaction_start(None, "transaction.test") with trace("root", "custom"): with trace("child1-leaf", "custom", leaf=True): # These two traces should not show up with trace("ignored-child1", "custom", leaf=True): time.sleep(0.01) with trace("ignored-child2", "custom", leaf=False): time.sleep(0.01) self.requests_store.transaction_end(None, "transaction") transactions, traces = self.requests_store.get_all() self.assertEqual(len(traces), 3) signatures = ['transaction', 'root', 'child1-leaf'] self.assertEqual(set([t['signature'] for t in traces]), set(signatures))
def test_leaf_tracing(self): self.requests_store.begin_transaction("transaction.test") with trace("root", "custom"): with trace("child1-leaf", "custom", leaf=True): # These two traces should not show up with trace("ignored-child1", "custom", leaf=True): time.sleep(0.01) with trace("ignored-child2", "custom", leaf=False): time.sleep(0.01) self.requests_store.end_transaction(None, "transaction") transactions = self.requests_store.get_all() traces = transactions[0]['traces'] self.assertEqual(len(traces), 3) signatures = ['transaction', 'root', 'child1-leaf'] self.assertEqual(set([t['name'] for t in traces]), set(signatures))
def test_requests_instrumentation_via_session(self, mock_send): mock_send.return_value = mock.Mock( url='http://example.com', history=[], headers={'location': ''}, ) self.client.begin_transaction("transaction.test") with trace("test_pipeline", "test"): s = requests.Session() s.get('http://example.com', allow_redirects=False) self.client.end_transaction("MyView") _, traces = self.client.instrumentation_store.get_all() self.assertIn('GET example.com', map(lambda x: x['signature'], traces))
def test_requests_instrumentation_via_session(self, mock_send): mock_send.return_value = mock.Mock( url='http://example.com', history=[], headers={'location': ''}, ) self.client.begin_transaction("transaction.test") with trace("test_pipeline", "test"): s = requests.Session() s.get('http://example.com', allow_redirects=False) self.client.end_transaction("MyView") transactions = self.client.instrumentation_store.get_all() traces = transactions[0]['traces'] self.assertEqual('GET example.com', traces[0]['name']) self.assertEqual('http://example.com/', traces[0]['context']['url'])
def test_botocore_instrumentation(self, mock_make_request): mock_response = mock.Mock() mock_response.status_code = 200 mock_make_request.return_value = (mock_response, {}) self.client.begin_transaction("transaction.test") with trace("test_pipeline", "test"): session = boto3.Session(aws_access_key_id='foo', aws_secret_access_key='bar', region_name='us-west-2') ec2 = session.client('ec2') ec2.describe_instances() self.client.end_transaction("MyView") _, traces = self.client.instrumentation_store.get_all() self.assertIn('ec2:DescribeInstances', map(lambda x: x['signature'], traces))
def test_requests_instrumentation(self, mock_send): mock_send.return_value = mock.Mock( url='http://example.com', history=[], headers={'location': ''}, ) self.client.begin_transaction("transaction.test") with trace("test_pipeline", "test"): # NOTE: The `allow_redirects` argument has to be set to `False`, # because mocking is done a level deeper, and the mocked response # from the `HTTPAdapter` is about to be used to make further # requests to resolve redirects, which doesn't make sense for this # test case. requests.get('http://example.com', allow_redirects=False) self.client.end_transaction("MyView") _, traces = self.client.instrumentation_store.get_all() self.assertIn('GET example.com', map(lambda x: x['signature'], traces))
def call(self, module, method, wrapped, instance, args, kwargs): signature = "psycopg2.connect" host = kwargs.get('host') if host: signature += " " + str(host) port = kwargs.get('port') if port: port = str(port) if int(port) != default_ports.get("postgresql"): signature += ":" + port else: # Parse connection string and extract host/port pass with trace(signature, "db.postgreql.connect"): return PGConnectionProxy(wrapped(*args, **kwargs))
def call(self, module, method, wrapped, instance, args, kwargs): if 'operation_name' in kwargs: operation_name = kwargs['operation_name'] else: operation_name = args[0] target_endpoint = instance._endpoint.host parsed_url = urlparse.urlparse(target_endpoint) service, region, _ = parsed_url.hostname.split('.', 2) signature = '{}:{}'.format(service, operation_name) extra_data = { 'service': service, 'region': region, 'operation': operation_name, } with trace(signature, 'ext.http.aws', extra_data, leaf=True): return wrapped(*args, **kwargs)
def test_rq_patches_redis(self, should_collect): should_collect.return_value = False # Let's go ahead and change how something important works conn = redis.StrictRedis() conn._pipeline = partial(StrictRedis.pipeline, conn) self.client.begin_transaction("transaction.test") with trace("test_pipeline", "test"): # conn = redis.StrictRedis() pipeline = conn._pipeline() pipeline.rpush("mykey", "a", "b") pipeline.expire("mykey", 1000) pipeline.execute() self.client.end_transaction("MyView") transactions, traces = self.client.instrumentation_store.get_all() expected_signatures = [ 'transaction', 'test_pipeline', 'StrictPipeline.execute' ] self.assertEqual(set([t['signature'] for t in traces]), set(expected_signatures)) # Reorder according to the kinds list so we can just test them sig_dict = dict([(t['signature'], t) for t in traces]) traces = [sig_dict[k] for k in expected_signatures] self.assertEqual(traces[0]['signature'], 'transaction') self.assertEqual(traces[0]['kind'], 'transaction') self.assertEqual(traces[0]['transaction'], 'MyView') self.assertEqual(traces[1]['signature'], 'test_pipeline') self.assertEqual(traces[1]['kind'], 'test') self.assertEqual(traces[1]['transaction'], 'MyView') self.assertEqual(traces[2]['signature'], 'StrictPipeline.execute') self.assertEqual(traces[2]['kind'], 'cache.redis') self.assertEqual(traces[2]['transaction'], 'MyView') self.assertEqual(len(traces), 3)
def test_rq_patches_redis(self, should_collect): should_collect.return_value = False # Let's go ahead and change how something important works conn = redis.StrictRedis() conn._pipeline = partial(StrictRedis.pipeline, conn) self.client.begin_transaction("transaction.test") with trace("test_pipeline", "test"): # conn = redis.StrictRedis() pipeline = conn._pipeline() pipeline.rpush("mykey", "a", "b") pipeline.expire("mykey", 1000) pipeline.execute() self.client.end_transaction("MyView") transactions, traces = self.client.instrumentation_store.get_all() expected_signatures = ['transaction', 'test_pipeline', 'StrictPipeline.execute'] self.assertEqual(set([t['signature'] for t in traces]), set(expected_signatures)) # Reorder according to the kinds list so we can just test them sig_dict = dict([(t['signature'], t) for t in traces]) traces = [sig_dict[k] for k in expected_signatures] self.assertEqual(traces[0]['signature'], 'transaction') self.assertEqual(traces[0]['kind'], 'transaction') self.assertEqual(traces[0]['transaction'], 'MyView') self.assertEqual(traces[1]['signature'], 'test_pipeline') self.assertEqual(traces[1]['kind'], 'test') self.assertEqual(traces[1]['transaction'], 'MyView') self.assertEqual(traces[2]['signature'], 'StrictPipeline.execute') self.assertEqual(traces[2]['kind'], 'cache.redis') self.assertEqual(traces[2]['transaction'], 'MyView') self.assertEqual(len(traces), 3)
def image(image_url=''): # Validate inputs = ImageInputs(request) if not inputs.validate(): raise ValidationError(inputs.errors) params = {'url': image_url, 'args': request.args} # print params params_hash = make_dict_hash(params) # Have we already processed this image? existing_image = views.redis.safe_get(params_hash) if existing_image: print 'Cache hit for segmented image' image = from_redis(existing_image) return return_image(image) image = get_image(image_url) # print 'dimensions', image.shape # drop extra params allowed_keys = ('colour_space', 'cluster_method', 'num_clusters', 'quantile') kwargs = {k: v for k, v in params['args'].iteritems() if k in allowed_keys} cj = ClusterJob(image, **kwargs) cj.scale() # Cache resized image image_url_hash = make_url_hash(image_url) views.redis.safe_set(image_url_hash, to_redis(cj.image)) # TODO time with trace("cluster"): cj.cluster() # Cache result views.redis.safe_set(params_hash, to_redis(cj.segmented_image)) return return_image(cj.segmented_image)
def test_memcached(self, should_collect): should_collect.return_value = False self.client.begin_transaction("transaction.test") with trace("test_memcached", "test"): conn = memcache.Client(['127.0.0.1:11211'], debug=0) conn.set("mykey", "a") assert "a" == conn.get("mykey") assert {"mykey": "a"} == conn.get_multi(["mykey", "myotherkey"]) self.client.end_transaction("BillingView") transactions = self.client.instrumentation_store.get_all() traces = transactions[0]['traces'] expected_signatures = [ 'transaction', 'test_memcached', 'Client.set', 'Client.get', 'Client.get_multi' ] self.assertEqual(set([t['name'] for t in traces]), set(expected_signatures)) self.assertEqual(traces[0]['name'], 'Client.set') self.assertEqual(traces[0]['type'], 'cache.memcached') self.assertEqual(traces[0]['parent'], 1) self.assertEqual(traces[1]['name'], 'Client.get') self.assertEqual(traces[1]['type'], 'cache.memcached') self.assertEqual(traces[1]['parent'], 1) self.assertEqual(traces[2]['name'], 'Client.get_multi') self.assertEqual(traces[2]['type'], 'cache.memcached') self.assertEqual(traces[2]['parent'], 1) self.assertEqual(traces[3]['name'], 'test_memcached') self.assertEqual(traces[3]['type'], 'test') self.assertEqual(traces[4]['name'], 'transaction') self.assertEqual(traces[4]['type'], 'transaction') self.assertEqual(len(traces), 5)
def test_redis_client(self, should_collect): should_collect.return_value = False self.client.begin_transaction("transaction.test") with trace("test_redis_client", "test"): conn = redis.StrictRedis() conn.rpush("mykey", "a", "b") conn.expire("mykey", 1000) self.client.end_transaction("MyView") transactions, traces = self.client.instrumentation_store.get_all() expected_signatures = [ 'transaction', 'test_redis_client', 'RPUSH', 'EXPIRE' ] self.assertEqual(set([t['signature'] for t in traces]), set(expected_signatures)) # Reorder according to the kinds list so we can just test them sig_dict = dict([(t['signature'], t) for t in traces]) traces = [sig_dict[k] for k in expected_signatures] self.assertEqual(traces[0]['signature'], 'transaction') self.assertEqual(traces[0]['kind'], 'transaction') self.assertEqual(traces[0]['transaction'], 'MyView') self.assertEqual(traces[1]['signature'], 'test_redis_client') self.assertEqual(traces[1]['kind'], 'test') self.assertEqual(traces[1]['transaction'], 'MyView') self.assertEqual(traces[2]['signature'], 'RPUSH') self.assertEqual(traces[2]['kind'], 'cache.redis') self.assertEqual(traces[2]['transaction'], 'MyView') self.assertEqual(traces[3]['signature'], 'EXPIRE') self.assertEqual(traces[3]['kind'], 'cache.redis') self.assertEqual(traces[3]['transaction'], 'MyView') self.assertEqual(len(traces), 4)
def call(self, module, method, wrapped, instance, args, kwargs): if 'method' in kwargs: method = kwargs['method'] else: method = args[0] host = instance.host if instance.port != default_ports.get(instance.scheme): host += ":" + str(instance.port) if 'url' in kwargs: url = kwargs['url'] else: url = args[1] signature = method.upper() + " " + host url = instance.scheme + "://" + host + url with trace(signature, "ext.http.urllib3", {'url': url}, leaf=True): return wrapped(*args, **kwargs)
def test_redis_client(self, should_collect): should_collect.return_value = False self.client.begin_transaction("transaction.test") with trace("test_redis_client", "test"): conn = redis.StrictRedis() conn.rpush("mykey", "a", "b") conn.expire("mykey", 1000) self.client.end_transaction("MyView") transactions, traces = self.client.instrumentation_store.get_all() expected_signatures = ['transaction', 'test_redis_client', 'RPUSH', 'EXPIRE'] self.assertEqual(set([t['signature'] for t in traces]), set(expected_signatures)) # Reorder according to the kinds list so we can just test them sig_dict = dict([(t['signature'], t) for t in traces]) traces = [sig_dict[k] for k in expected_signatures] self.assertEqual(traces[0]['signature'], 'transaction') self.assertEqual(traces[0]['kind'], 'transaction') self.assertEqual(traces[0]['transaction'], 'MyView') self.assertEqual(traces[1]['signature'], 'test_redis_client') self.assertEqual(traces[1]['kind'], 'test') self.assertEqual(traces[1]['transaction'], 'MyView') self.assertEqual(traces[2]['signature'], 'RPUSH') self.assertEqual(traces[2]['kind'], 'cache.redis') self.assertEqual(traces[2]['transaction'], 'MyView') self.assertEqual(traces[3]['signature'], 'EXPIRE') self.assertEqual(traces[3]['kind'], 'cache.redis') self.assertEqual(traces[3]['transaction'], 'MyView') self.assertEqual(len(traces), 4)
def test_urllib3(self, should_collect): should_collect.return_value = False self.client.begin_transaction("transaction") expected_sig = 'GET localhost:{0}'.format(self.port) with trace("test_pipeline", "test"): pool = urllib3.PoolManager(timeout=0.1) url = 'http://localhost:{0}/hello_world'.format(self.port) r = pool.request('GET', url) self.client.end_transaction("MyView") transactions, traces = self.client.instrumentation_store.get_all() expected_signatures = ['transaction', 'test_pipeline', expected_sig] self.assertEqual(set([t['signature'] for t in traces]), set(expected_signatures)) # Reorder according to the kinds list so we can just test them sig_dict = dict([(t['signature'], t) for t in traces]) traces = [sig_dict[k] for k in expected_signatures] self.assertEqual(len(traces), 3) self.assertEqual(traces[0]['signature'], 'transaction') self.assertEqual(traces[0]['kind'], 'transaction') self.assertEqual(traces[0]['transaction'], 'MyView') self.assertEqual(traces[1]['signature'], 'test_pipeline') self.assertEqual(traces[1]['kind'], 'test') self.assertEqual(traces[1]['transaction'], 'MyView') self.assertEqual(traces[2]['signature'], expected_sig) self.assertEqual(traces[2]['kind'], 'ext.http.urllib3') self.assertEqual(traces[2]['transaction'], 'MyView') self.assertEqual(traces[2]['extra']['url'], url)
def test_memcached(self, should_collect): should_collect.return_value = False self.client.begin_transaction("transaction.test") with trace("test_memcached", "test"): conn = memcache.Client(['127.0.0.1:11211'], debug=0) conn.set("mykey", "a") assert "a" == conn.get("mykey") assert {"mykey": "a"} == conn.get_multi(["mykey", "myotherkey"]) self.client.end_transaction("BillingView") transactions, traces = self.client.instrumentation_store.get_all() expected_signatures = [ 'transaction', 'test_memcached', 'Client.set', 'Client.get', 'Client.get_multi' ] self.assertEqual(set([t['signature'] for t in traces]), set(expected_signatures)) # Reorder according to the kinds list so we can just test them sig_dict = dict([(t['signature'], t) for t in traces]) traces = [sig_dict[k] for k in expected_signatures] self.assertEqual(traces[0]['signature'], 'transaction') self.assertEqual(traces[0]['kind'], 'transaction') self.assertEqual(traces[0]['transaction'], 'BillingView') self.assertEqual(traces[1]['signature'], 'test_memcached') self.assertEqual(traces[1]['kind'], 'test') self.assertEqual(traces[1]['transaction'], 'BillingView') self.assertEqual(traces[2]['signature'], 'Client.set') self.assertEqual(traces[2]['kind'], 'cache.memcached') self.assertEqual(traces[2]['transaction'], 'BillingView') self.assertEqual(len(traces), 5)
def test_memcached(self, should_collect): should_collect.return_value = False self.client.begin_transaction("transaction.test") with trace("test_memcached", "test"): conn = memcache.Client(['127.0.0.1:11211'], debug=0) conn.set("mykey", "a") assert "a" == conn.get("mykey") assert {"mykey": "a"} == conn.get_multi(["mykey", "myotherkey"]) self.client.end_transaction("BillingView") transactions, traces = self.client.instrumentation_store.get_all() expected_signatures = ['transaction', 'test_memcached', 'Client.set', 'Client.get', 'Client.get_multi'] self.assertEqual(set([t['signature'] for t in traces]), set(expected_signatures)) # Reorder according to the kinds list so we can just test them sig_dict = dict([(t['signature'], t) for t in traces]) traces = [sig_dict[k] for k in expected_signatures] self.assertEqual(traces[0]['signature'], 'transaction') self.assertEqual(traces[0]['kind'], 'transaction') self.assertEqual(traces[0]['transaction'], 'BillingView') self.assertEqual(traces[1]['signature'], 'test_memcached') self.assertEqual(traces[1]['kind'], 'test') self.assertEqual(traces[1]['transaction'], 'BillingView') self.assertEqual(traces[2]['signature'], 'Client.set') self.assertEqual(traces[2]['kind'], 'cache.memcached') self.assertEqual(traces[2]['transaction'], 'BillingView') self.assertEqual(len(traces), 5)
def test_rq_patches_redis(self, should_collect): should_collect.return_value = False # Let's go ahead and change how something important works conn = redis.StrictRedis() conn._pipeline = partial(StrictRedis.pipeline, conn) self.client.begin_transaction("transaction.test") with trace("test_pipeline", "test"): # conn = redis.StrictRedis() pipeline = conn._pipeline() pipeline.rpush("mykey", "a", "b") pipeline.expire("mykey", 1000) pipeline.execute() self.client.end_transaction("MyView") transactions = self.client.instrumentation_store.get_all() traces = transactions[0]['traces'] expected_signatures = [ 'transaction', 'test_pipeline', 'StrictPipeline.execute' ] self.assertEqual(set([t['name'] for t in traces]), set(expected_signatures)) self.assertEqual(traces[0]['name'], 'StrictPipeline.execute') self.assertEqual(traces[0]['type'], 'cache.redis') self.assertEqual(traces[1]['name'], 'test_pipeline') self.assertEqual(traces[1]['type'], 'test') self.assertEqual(traces[2]['name'], 'transaction') self.assertEqual(traces[2]['type'], 'transaction') self.assertEqual(len(traces), 3)
def something_expensive(): with trace("something_expensive", "code"): return [User(username="******"), User(username="******")]
def test_requests_instrumentation_malformed_path(self): self.client.begin_transaction("transaction.test") with trace("test_pipeline", "test"): self.assertRaises(InvalidURL, requests.get, 'http://')
def test_requests_instrumentation_malformed_schema(self): self.client.begin_transaction("transaction.test") with trace("test_pipeline", "test"): self.assertRaises(MissingSchema, requests.get, '')
def something_expensive(): with trace("something_expensive", "code"): for i in range(100): users = list(User.objects.all()) return users
def something_expensive(): with trace("something_expensive", "code"): return [User(username='******'), User(username='******')]
def call(self, module, method, wrapped, instance, args, kwargs): collection = instance.collection signature = '.'.join([collection.full_name, 'cursor.refresh']) with trace(signature, "db.mongodb.query"): return wrapped(*args, **kwargs)
def call(self, module, method, wrapped, instance, args, kwargs): signature = instance.name or instance.filename with trace(signature, "template.jinja2"): return wrapped(*args, **kwargs)
def call(self, module, method, wrapped, instance, args, kwargs): wrapped_name = self.get_wrapped_name(wrapped, instance, method) with trace(wrapped_name, "cache.memcached"): return wrapped(*args, **kwargs)
def call(self, module, method, wrapped, instance, args, kwargs): wrapped_name = module + "." + method with trace(wrapped_name, "compression.zlib"): return wrapped(*args, **kwargs)