Skip to main content

BDD项目日志和追踪SDK

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bdd_trace-0.5.6.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bdd_trace-0.5.6-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file bdd_trace-0.5.6.tar.gz.

File metadata

  • Download URL: bdd_trace-0.5.6.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.15

File hashes

Hashes for bdd_trace-0.5.6.tar.gz
Algorithm Hash digest
SHA256 d7e73cd34471003b45b62b2686d53080687a6073aa5e5ba84b60f0fce10e5a74
MD5 b3a414ee641db8cbcc4e43f5dfc9a472
BLAKE2b-256 a2fc6c1ed0e5b4f31ba403a504d88a8777d99a12af39801d62e59db0336250c5

See more details on using hashes here.

File details

Details for the file bdd_trace-0.5.6-py3-none-any.whl.

File metadata

  • Download URL: bdd_trace-0.5.6-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.15

File hashes

Hashes for bdd_trace-0.5.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5be760865be32b5d3555c4ba31f6f8a9755984dbd352c7fb3efdbc6d3591ccc4
MD5 29315ff7e431b62cc40d69f825525854
BLAKE2b-256 86a4cd4789d544038dd709658aa3ad73aa33984829d35abd44e0f1ef374b565b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page