当前位置: 首页>>代码示例>>Python>>正文


Python Client.begin_transaction方法代码示例

本文整理汇总了Python中opbeat.base.Client.begin_transaction方法的典型用法代码示例。如果您正苦于以下问题:Python Client.begin_transaction方法的具体用法?Python Client.begin_transaction怎么用?Python Client.begin_transaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在opbeat.base.Client的用法示例。


在下文中一共展示了Client.begin_transaction方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_call_end_twice

# 需要导入模块: from opbeat.base import Client [as 别名]
# 或者: from opbeat.base.Client import begin_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')
开发者ID:tarkatronic,项目名称:opbeat_python,代码行数:15,代码来源:client_tests.py

示例2: test_metrics_collection

# 需要导入模块: from opbeat.base import Client [as 别名]
# 或者: from opbeat.base.Client import begin_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)
开发者ID:opbeat,项目名称:opbeat_python,代码行数:19,代码来源:client_tests.py

示例3: test_ignore_patterns

# 需要导入模块: from opbeat.base import Client [as 别名]
# 或者: from opbeat.base.Client import begin_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)
开发者ID:opbeat,项目名称:opbeat_python,代码行数:20,代码来源:client_tests.py

示例4: test_metrics_collection

# 需要导入模块: from opbeat.base import Client [as 别名]
# 或者: from opbeat.base.Client import begin_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)
开发者ID:patrys,项目名称:opbeat_python,代码行数:22,代码来源:client_tests.py

示例5: test_ignore_patterns

# 需要导入模块: from opbeat.base import Client [as 别名]
# 或者: from opbeat.base.Client import begin_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)
开发者ID:bastih,项目名称:opbeat_python,代码行数:23,代码来源:client_tests.py


注:本文中的opbeat.base.Client.begin_transaction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。