예제 #1
0
    def test_missing_trace_context(self) -> None:
        start, finish = self.__get_timestamps()
        message = TransactionEvent(
            event_id="e5e062bf2e1d4afd96fd2f90b6770431",
            trace_id="7400045b25c443b885914600aa83ad04",
            span_id="8841662216cc598b",
            transaction_name="/organizations/:orgId/issues/",
            status="cancelled",
            op="navigation",
            timestamp=finish,
            start_timestamp=start,
            platform="python",
            dist="",
            user_name="me",
            user_id="myself",
            user_email="*****@*****.**",
            ipv4="127.0.0.1",
            ipv6=None,
            environment="prod",
            release="34a554c14b68285d8a8eb6c5c4c56dfc1db9a83a",
            sdk_name="sentry.python",
            sdk_version="0.9.0",
            http_method="POST",
            http_referer="tagstore.something",
            geo={"country_code": "XY", "region": "fake_region", "city": "fake_city"},
        )
        payload = message.serialize()
        # Force an invalid event
        del payload[2]["data"]["contexts"]

        meta = KafkaMessageMetadata(
            offset=1, partition=2, timestamp=datetime(1970, 1, 1)
        )
        processor = TransactionsMessageProcessor()
        assert processor.process_message(payload, meta) is None
예제 #2
0
    def test_missing_trace_context(self):
        message = TransactionEvent(
            event_id='e5e062bf2e1d4afd96fd2f90b6770431',
            trace_id='7400045b25c443b885914600aa83ad04',
            span_id='8841662216cc598b',
            transaction_name='/organizations/:orgId/issues/',
            op='navigation',
            start_timestamp=1565303392.917,
            timestamp=1565303393.918,
            platform='python',
            dist='',
            user_name='me',
            user_id='myself',
            user_email='*****@*****.**',
            ipv4='127.0.0.1',
            ipv6=None,
            environment='prod',
            release='34a554c14b68285d8a8eb6c5c4c56dfc1db9a83a',
        )
        payload = message.serialize()
        # Force an invalid event
        del payload[2]['data']['contexts']

        meta = KafkaMessageMetadata(offset=1, partition=2)
        processor = TransactionsMessageProcessor()
        assert processor.process_message(payload, meta) is None
예제 #3
0
    def test_base_process(self):
        message = TransactionEvent(
            event_id='e5e062bf2e1d4afd96fd2f90b6770431',
            trace_id='7400045b25c443b885914600aa83ad04',
            span_id='8841662216cc598b',
            transaction_name='/organizations/:orgId/issues/',
            op='navigation',
            start_timestamp=1565303393.917,
            timestamp=1565303392.918,
            platform='python',
            dist='',
            user_name='me',
            user_id='myself',
            user_email='*****@*****.**',
            ipv4='127.0.0.1',
            ipv6=None,
            environment='prod',
            release='34a554c14b68285d8a8eb6c5c4c56dfc1db9a83a',
        )
        meta = KafkaMessageMetadata(
            offset=1,
            partition=2,
        )

        processor = TransactionsMessageProcessor()
        ret = processor.process_message(message.serialize(), meta)

        assert ret.action == ProcessorAction.INSERT
        assert ret.data == [message.build_result(meta)]
예제 #4
0
    def test_base_process(self):
        start, finish = self.__get_timestamps()
        message = TransactionEvent(
            event_id="e5e062bf2e1d4afd96fd2f90b6770431",
            trace_id="7400045b25c443b885914600aa83ad04",
            span_id="8841662216cc598b",
            transaction_name="/organizations/:orgId/issues/",
            status="cancelled",
            op="navigation",
            timestamp=finish,
            start_timestamp=start,
            platform="python",
            dist="",
            user_name="me",
            user_id="myself",
            user_email="*****@*****.**",
            ipv4="127.0.0.1",
            ipv6=None,
            environment="prod",
            release="34a554c14b68285d8a8eb6c5c4c56dfc1db9a83a",
            sdk_name="sentry.python",
            sdk_version="0.9.0",
            geo={
                "country_code": "XY",
                "region": "fake_region",
                "city": "fake_city"
            },
        )
        meta = KafkaMessageMetadata(
            offset=1,
            partition=2,
        )

        processor = TransactionsMessageProcessor()
        ret = processor.process_message(message.serialize(), meta)

        assert ret.action == ProcessorAction.INSERT
        assert ret.data == [message.build_result(meta)]