當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。