本文整理匯總了Python中aiohttp.TraceConfig方法的典型用法代碼示例。如果您正苦於以下問題:Python aiohttp.TraceConfig方法的具體用法?Python aiohttp.TraceConfig怎麽用?Python aiohttp.TraceConfig使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類aiohttp
的用法示例。
在下文中一共展示了aiohttp.TraceConfig方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: aws_xray_trace_config
# 需要導入模塊: import aiohttp [as 別名]
# 或者: from aiohttp import TraceConfig [as 別名]
def aws_xray_trace_config(name=None):
"""
:param name: name used to identify the subsegment, with None internally the URL will
be used as identifier.
:returns: TraceConfig.
"""
def _trace_config_ctx_factory(trace_request_ctx):
return SimpleNamespace(
name=name,
trace_request_ctx=trace_request_ctx
)
trace_config = aiohttp.TraceConfig(trace_config_ctx_factory=_trace_config_ctx_factory)
trace_config.on_request_start.append(begin_subsegment)
trace_config.on_request_end.append(end_subsegment)
trace_config.on_request_exception.append(end_subsegment_with_exception)
return trace_config
示例2: init_with_instana
# 需要導入模塊: import aiohttp [as 別名]
# 或者: from aiohttp import TraceConfig [as 別名]
def init_with_instana(wrapped, instance, argv, kwargs):
instana_trace_config = aiohttp.TraceConfig()
instana_trace_config.on_request_start.append(stan_request_start)
instana_trace_config.on_request_end.append(stan_request_end)
instana_trace_config.on_request_exception.append(stan_request_exception)
if 'trace_configs' in kwargs:
kwargs['trace_configs'].append(instana_trace_config)
else:
kwargs['trace_configs'] = [instana_trace_config]
return wrapped(*argv, **kwargs)
示例3: make_trace_config
# 需要導入模塊: import aiohttp [as 別名]
# 或者: from aiohttp import TraceConfig [as 別名]
def make_trace_config(tracer: Tracer) -> aiohttp.TraceConfig:
"""Creates aiohttp.TraceConfig with enabled aiozipking instrumentation
for aiohttp client.
"""
trace_config = aiohttp.TraceConfig()
zipkin = ZipkinClientSignals(tracer)
trace_config.on_request_start.append(zipkin.on_request_start)
trace_config.on_request_end.append(zipkin.on_request_end)
trace_config.on_request_exception.append(zipkin.on_request_exception)
return trace_config