コード例 #1
0
    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()

        client.end_transaction(200, 'test-transaction')
        client.end_transaction(200, 'test-transaction')
コード例 #2
0
    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')
コード例 #3
0
    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
0
ファイル: client_tests.py プロジェクト: opbeat/opbeat_python
    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)
コード例 #5
0
ファイル: client_tests.py プロジェクト: opbeat/opbeat_python
    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)
コード例 #6
0
ファイル: client_tests.py プロジェクト: patrys/opbeat_python
    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)
コード例 #7
0
    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)
コード例 #8
0
ファイル: client_tests.py プロジェクト: bastih/opbeat_python
    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)