OpenTelemetry urllib3 仪表化
项目描述
此库允许使用urllib3库进行HTTP请求跟踪。
安装
pip install opentelemetry-instrumentation-urllib3
配置
请求/响应钩子
urllib3仪表化支持通过请求和响应钩子扩展跟踪行为。这些是在为请求创建跨度后和跨度完成响应处理前由仪表化调用的函数。钩子可以按以下方式配置
# `request` is an instance of urllib3.connectionpool.HTTPConnectionPool
def request_hook(span, request):
pass
# `request` is an instance of urllib3.connectionpool.HTTPConnectionPool
# `response` is an instance of urllib3.response.HTTPResponse
def response_hook(span, request, response):
pass
URLLib3Instrumentor().instrument(
request_hook=request_hook, response_hook=response_hook
)
排除列表
要排除某些URL的跟踪,请设置环境变量OTEL_PYTHON_URLLIB3_EXCLUDED_URLS(或回退为OTEL_PYTHON_EXCLUDED_URLS)以逗号分隔的正则表达式,表示要排除的URL。
例如,
export OTEL_PYTHON_URLLIB3_EXCLUDED_URLS="client/.*/info,healthcheck"
将排除类似于https://site/client/123/info和https://site/xyz/healthcheck的请求。
参考
项目详情
关闭
哈希值 for opentelemetry_instrumentation_urllib3-0.48b0.tar.gz
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 6b03d6ee9b6e001cc73bb07ccf71bc42886eb006885ff6d53b5b00751bb01326 |
|
MD5 | b642b0e1c25dde2aeb5b748a471cb163 |
|
BLAKE2b-256 | a395aff5c7533096c8809b6d073fbbca6cbde057ce898355424c2d77c61fc456 |
关闭
哈希值 for opentelemetry_instrumentation_urllib3-0.48b0-py3-none-any.whl
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 3ba2b874d798996a105fcb887491ecf78c1c47dc39516c8544680b2e32fc8d18 |
|
MD5 | 3dfd974f1b51a5cddd799c639bee0f52 |
|
BLAKE2b-256 | 2e36ca3c9f077a3e682de59f9178a87c4580d051b01172cb5b4c3052de8f590e |