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


Python Baseplate.configure_tracing方法代码示例

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


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

示例1: test_configure_tracing_with_defaults_legacy_style

# 需要导入模块: from baseplate import Baseplate [as 别名]
# 或者: from baseplate.Baseplate import configure_tracing [as 别名]
 def test_configure_tracing_with_defaults_legacy_style(self):
     baseplate = Baseplate()
     self.assertEqual(0, len(baseplate.observers))
     baseplate.configure_tracing('test')
     self.assertEqual(1, len(baseplate.observers))
     tracing_observer = baseplate.observers[0]
     self.assertEqual('test',tracing_observer.service_name)
开发者ID:ckwang8128,项目名称:baseplate,代码行数:9,代码来源:tracing_tests.py

示例2: test_configure_tracing_with_defaults_new_style

# 需要导入模块: from baseplate import Baseplate [as 别名]
# 或者: from baseplate.Baseplate import configure_tracing [as 别名]
 def test_configure_tracing_with_defaults_new_style(self):
     baseplate = Baseplate()
     self.assertEqual(0, len(baseplate.observers))
     client = make_client("test")
     baseplate.configure_tracing(client)
     self.assertEqual(1, len(baseplate.observers))
     tracing_observer = baseplate.observers[0]
     self.assertEqual('test',tracing_observer.service_name)
开发者ID:ckwang8128,项目名称:baseplate,代码行数:10,代码来源:tracing_tests.py

示例3: test_configure_tracing_with_args

# 需要导入模块: from baseplate import Baseplate [as 别名]
# 或者: from baseplate.Baseplate import configure_tracing [as 别名]
 def test_configure_tracing_with_args(self):
     baseplate = Baseplate()
     self.assertEqual(0, len(baseplate.observers))
     baseplate.configure_tracing('test',
                                 None,
                                 max_span_queue_size=500,
                                 num_span_workers=5,
                                 span_batch_interval=0.5,
                                 num_conns=100,
                                 sample_rate=0.1)
     self.assertEqual(1, len(baseplate.observers))
     tracing_observer = baseplate.observers[0]
     self.assertEqual('test', tracing_observer.service_name)
开发者ID:ckwang8128,项目名称:baseplate,代码行数:15,代码来源:tracing_tests.py

示例4: Globals

# 需要导入模块: from baseplate import Baseplate [as 别名]
# 或者: from baseplate.Baseplate import configure_tracing [as 别名]

#.........这里部分代码省略.........
            ``config/middleware.py`` namely, the variables from the
            section in the config file for your application.

        ``extra``
            The configuration returned from ``load_config`` in 
            ``config/middleware.py`` which may be of use in the setup of
            your global variables.

        """

        global_conf.setdefault("debug", False)

        # reloading site ensures that we have a fresh sys.path to build our
        # working set off of. this means that forked worker processes won't get
        # the sys.path that was current when the master process was spawned
        # meaning that new plugins will be picked up on regular app reload
        # rather than having to restart the master process as well.
        reload(site)
        self.pkg_resources_working_set = pkg_resources.WorkingSet()

        self.config = ConfigValueParser(global_conf)
        self.config.add_spec(self.spec)
        self.plugins = PluginLoader(self.pkg_resources_working_set,
                                    self.config.get("plugins", []))

        self.stats = Stats(self.config.get('statsd_addr'),
                           self.config.get('statsd_sample_rate'))
        self.startup_timer = self.stats.get_timer("app_startup")
        self.startup_timer.start()

        self.baseplate = Baseplate()
        self.baseplate.configure_logging()
        self.baseplate.register(R2BaseplateObserver())
        self.baseplate.configure_tracing(
            "r2",
            tracing_endpoint=self.config.get("tracing_endpoint"),
            sample_rate=self.config.get("tracing_sample_rate"),
        )

        self.paths = paths

        self.running_as_script = global_conf.get('running_as_script', False)
        
        # turn on for language support
        self.lang = getattr(self, 'site_lang', 'en')
        self.languages, self.lang_name = get_active_langs(
            config, default_lang=self.lang)

        all_languages = self.lang_name.keys()
        all_languages.sort()
        self.all_languages = all_languages
        
        # set default time zone if one is not set
        tz = global_conf.get('timezone', 'UTC')
        self.tz = pytz.timezone(tz)
        
        dtz = global_conf.get('display_timezone', tz)
        self.display_tz = pytz.timezone(dtz)

        self.startup_timer.intermediate("init")

    def __getattr__(self, name):
        if not name.startswith('_') and name in self.config:
            return self.config[name]
        else:
            raise AttributeError("g has no attr %r" % name)
开发者ID:AHAMED750,项目名称:reddit,代码行数:70,代码来源:app_globals.py


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