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


Python ESCrashStorage._submit_crash_to_elasticsearch方法代码示例

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


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

示例1: test_index_crash

# 需要导入模块: from socorro.external.es.crashstorage import ESCrashStorage [as 别名]
# 或者: from socorro.external.es.crashstorage.ESCrashStorage import _submit_crash_to_elasticsearch [as 别名]
    def test_index_crash(self):
        """Mock test the entire crash submission mechanism"""
        es_storage = ESCrashStorage(config=self.config)

        # This is the function that would actually connect to ES; by mocking
        # it entirely we are ensuring that ES doesn't actually get touched.
        es_storage._submit_crash_to_elasticsearch = mock.Mock()

        es_storage.save_raw_and_processed(
            raw_crash=deepcopy(a_raw_crash),
            dumps=None,
            processed_crash=deepcopy(a_processed_crash),
            crash_id=a_processed_crash['uuid']
        )

        # Ensure that the indexing function is only called once.
        assert es_storage._submit_crash_to_elasticsearch.call_count == 1
开发者ID:willkg,项目名称:socorro,代码行数:19,代码来源:test_crashstorage.py

示例2: test_crash_size_capture

# 需要导入模块: from socorro.external.es.crashstorage import ESCrashStorage [as 别名]
# 或者: from socorro.external.es.crashstorage.ESCrashStorage import _submit_crash_to_elasticsearch [as 别名]
    def test_crash_size_capture(self):
        """Verify we capture raw/processed crash sizes in ES crashstorage"""
        es_storage = ESCrashStorage(config=self.config)

        es_storage._submit_crash_to_elasticsearch = mock.Mock()

        es_storage.save_raw_and_processed(
            raw_crash=a_raw_crash,
            dumps=None,
            processed_crash=a_processed_crash,
            crash_id=a_processed_crash['uuid']
        )

        mock_calls = [str(call) for call in self.config.metrics.mock_calls]
        # NOTE(willkg): The sizes of these json documents depend on what's in them. If we changed
        # a_processed_crash and a_raw_crash, then these numbers will change.
        assert 'call.histogram(\'processor.es.raw_crash_size\', 27)' in mock_calls
        assert 'call.histogram(\'processor.es.processed_crash_size\', 1785)' in mock_calls
开发者ID:adngdb,项目名称:socorro,代码行数:20,代码来源:test_crashstorage.py

示例3: test_crash_size_capture

# 需要导入模块: from socorro.external.es.crashstorage import ESCrashStorage [as 别名]
# 或者: from socorro.external.es.crashstorage.ESCrashStorage import _submit_crash_to_elasticsearch [as 别名]
    def test_crash_size_capture(self):
        """Verify we capture raw/processed crash sizes in ES crashstorage"""
        with MetricsMock() as mm:
            es_storage = ESCrashStorage(config=self.config, namespace='processor.es')

            es_storage._submit_crash_to_elasticsearch = mock.Mock()

            es_storage.save_raw_and_processed(
                raw_crash=deepcopy(a_raw_crash),
                dumps=None,
                processed_crash=deepcopy(a_processed_crash),
                crash_id=a_processed_crash['uuid']
            )

            # NOTE(willkg): The sizes of these json documents depend on what's
            # in them. If we changed a_processed_crash and a_raw_crash, then
            # these numbers will change.
            assert mm.has_record('histogram', stat='processor.es.raw_crash_size', value=27)
            assert mm.has_record('histogram', stat='processor.es.processed_crash_size', value=1738)
开发者ID:willkg,项目名称:socorro,代码行数:21,代码来源:test_crashstorage.py


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