本文整理汇总了Python中opbeat.base.Client.end_transaction方法的典型用法代码示例。如果您正苦于以下问题:Python Client.end_transaction方法的具体用法?Python Client.end_transaction怎么用?Python Client.end_transaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opbeat.base.Client
的用法示例。
在下文中一共展示了Client.end_transaction方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_call_end_twice
# 需要导入模块: from opbeat.base import Client [as 别名]
# 或者: from opbeat.base.Client import end_transaction [as 别名]
def test_call_end_twice(self, should_collect, mock_send):
client = Client(
servers=['http://example.com'],
organization_id='organization_id',
app_id='app_id',
secret_token='secret',
)
should_collect.return_value = False
client.begin_transaction("celery")
client.end_transaction(200, 'test-transaction')
client.end_transaction(200, 'test-transaction')
示例2: test_metrics_collection
# 需要导入模块: from opbeat.base import Client [as 别名]
# 或者: from opbeat.base.Client import end_transaction [as 别名]
def test_metrics_collection(self, should_collect, mock_send):
client = Client(
servers=["http://example.com"], organization_id="organization_id", app_id="app_id", secret_token="secret"
)
should_collect.return_value = False
for i in range(7):
client.begin_transaction("transaction.test")
client.end_transaction("test-transaction", 200)
self.assertEqual(len(client.instrumentation_store), 7)
self.assertEqual(mock_send.call_count, 0)
should_collect.return_value = True
client.begin_transaction("transaction.test")
client.end_transaction("my-other-transaction", 200)
self.assertEqual(len(client.instrumentation_store), 0)
self.assertEqual(mock_send.call_count, 1)
示例3: test_ignore_patterns
# 需要导入模块: from opbeat.base import Client [as 别名]
# 或者: from opbeat.base.Client import end_transaction [as 别名]
def test_ignore_patterns(self, should_collect, mock_send):
client = Client(
servers=["http://example.com"],
organization_id="organization_id",
app_id="app_id",
secret_token="secret",
async_mode=True,
transactions_ignore_patterns=["^OPTIONS", "views.api.v2"],
)
should_collect.return_value = False
client.begin_transaction("web")
client.end_transaction("OPTIONS views.healthcheck", 200)
client.begin_transaction("web")
client.end_transaction("GET views.users", 200)
self.assertEqual(len(client.instrumentation_store), 1)
示例4: test_metrics_collection
# 需要导入模块: from opbeat.base import Client [as 别名]
# 或者: from opbeat.base.Client import end_transaction [as 别名]
def test_metrics_collection(self, should_collect, mock_send):
client = Client(
servers=['http://example.com'],
organization_id='organization_id',
app_id='app_id',
secret_token='secret',
)
should_collect.return_value = False
for i in range(7):
client.begin_transaction()
client.end_transaction(200, 'test-transaction')
self.assertEqual(len(client.instrumentation_store), 7)
self.assertEqual(mock_send.call_count, 0)
should_collect.return_value = True
client.begin_transaction()
client.end_transaction(200, 'my-other-transaction')
self.assertEqual(len(client.instrumentation_store), 0)
self.assertEqual(mock_send.call_count, 1)
示例5: test_ignore_patterns
# 需要导入模块: from opbeat.base import Client [as 别名]
# 或者: from opbeat.base.Client import end_transaction [as 别名]
def test_ignore_patterns(self, should_collect, mock_send):
client = Client(
servers=['http://example.com'],
organization_id='organization_id',
app_id='app_id',
secret_token='secret',
async_mode=True,
transactions_ignore_patterns=[
'^OPTIONS',
'views.api.v2'
]
)
should_collect.return_value = False
client.begin_transaction("web")
client.end_transaction('OPTIONS views.healthcheck', 200)
client.begin_transaction("web")
client.end_transaction('GET views.users', 200)
self.assertEqual(len(client.instrumentation_store), 1)