本文整理汇总了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