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

快速开始

基本使用

# 在所有导入之前,先导入 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.2.0.tar.gz (2.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.2.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for bdd_trace-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fd9aeaca901ae0e8e654d0eddef461d2f584c779a0788c03aa93068e4e1df2aa
MD5 8fea4272fd048eb288150e090fd26466
BLAKE2b-256 1674c4e47df000546c5431373979e08adc4084cc17b8b39574c5a30caefb9752

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for bdd_trace-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33ec3762edd883dd5ca90fd15852543d7a8a46092ec667d35544073d6c89d246
MD5 616e6f63b9c29d25691859c1f1510fc1
BLAKE2b-256 01c2d007abd07c41799b31338a54302f7e620d604c61e80cc4452c7c0bfa41fa

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