Archived
This project has been archived by its maintainers, and is no longer receiving any updates.
bdd-trace
一个方便 BDD 项目集成 OpenTelemetry 的 Python 库,提供简化的追踪初始化和配置功能。
功能特性
- 简化 OpenTelemetry 集成配置
- 支持开发和生产环境配置
- 提供统一的追踪初始化接口
- 支持 OTLP 导出器配置
- 自动处理追踪器设置
安装
推荐使用 uv 管理依赖:
uv add bdd-trace
uv sync
# 或者用 pip
pip install bdd-trace
然后安装 OpenTelemetry 的各种 Instrumentation:
# uv
uv run opentelemetry-bootstrap -a requirements | uv add -r -
uv sync
# pip
opentelemetry-bootstrap -a install
快速开始
基本使用
# 在所有导入之前,先导入 bdd_trace 并调用 init_trace 初始化
from bdd_trace import Profile, init_trace
# 预置了 DEV, TEST 和 PROD 三个环境的配置
init_trace(service_name="my-service", profile=Profile.DEV)
# 支持自定义配置
init_trace(
service_name="my-service",
# 自定义 OTLP 端点
exporter_otlp_endpoint="http://localhost:4317",
# 其他设置可运行 opentelemetry-instrument --help 查看
fastapi_exclude_urls="/healthCheck",
)
# 设置 profile=NO_TRACE 可以禁用自动追踪
init_trace(service_name="my-service", profile=Profile.NO_TRACE)
Release files for bdd-trace 0.5.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bdd_trace-0.5.7.tar.gz | 3.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bdd_trace-0.5.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.7 kB
Release files / bdd_trace-0.5.7.tar.gz
| Download URL | bdd_trace-0.5.7.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
06ebc2dc6247207caa78465d389ea04fae661c3d29b21c0f3e3d66abbcc6bcae
|
|
BLAKE2b-256 checksum How to use checksums |
e6ce642641d49c4e5af2da91548e0c085675723dae71385eacb1e75b0faf4e7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.15
|
Release files / bdd_trace-0.5.7-py3-none-any.whl
| Download URL | bdd_trace-0.5.7-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
36dd6b52ee7276c3c804e5dbb42bd820632b6d9cc61fe861a5a9ca40a26ee197
|
|
BLAKE2b-256 checksum How to use checksums |
8647164671028712c3337c159a6b1b52e40f341cbb3eb75f753b2f1b4bc90000
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.15
|