Token导航 LogoToken导航TokenDH.com
genai otel instrument logo
AI代理stdio官方级别未说明来源级核验

genai otel instrument

MCP Server

TraceVerde是一个全面的OpenTelemetry自动检测库,专为LLM/GenAI应用设计,提供零代码设置、多代理框架支持、成本跟踪和内置评估功能。

工具数

0

提示词数

0

GitHub Stars

1

资源数

0
PythonAI代理工作流自动化

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Mandark-droid

提供方

Mandark-droid

最后核验

2026/5/17 20:23

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install genai-otel-instrument

详细介绍

TraceVerde

用于LLM/GenAI应用程序的最全面的OpenTetry自动仪器库

*来自OpenTetry跟踪的跟踪。Verde的意思是绿色——可持续、透明的人工智能可观察性。*

](https://badge.fury.io/py/genai-otel-instrument) ](https://pypi.org/project/genai-otel-instrument/) ![License](https://opensource.org/licenses/Apache-2.0) ](https://pepy.tech/project/genai-otel-instrument) ](https://pepy.tech/project/genai-otel-instrument) ](https://github.com/Mandark-droid/genai_otel_instrument) ![OpenTelemetry](https://opentelemetry.io/) ![CI/CD](https://github.com/Mandark-droid/genai_otel_instrument/actions)

______________________________________________________________________

30秒内开始

pip install genai-otel-instrument
import genai_otel
genai_otel.instrument()

# Your existing code works unchanged - traces, metrics, and costs are captured automatically
import openai
client = openai.OpenAI()
response = client.chat.completions.create(model="gpt-4o-mini", messages=[{"role": "user", "content": "Hello!"}])

就是这样。没有包装器,没有装饰器,没有配置文件。每个LLM调用、数据库查询和代理交互都会自动跟踪并提供完整的成本明细。

为什么选择TraceVerde?

功能TraceVerdeOpenLITTraceloop/OpenLLMetricLangfuse
零代码设置需要SDK
法学硕士提供者19+25+15+通过集成
多代理框架8(CrewAI、LangGraph、ADK、AutoGen、OpenAI代理、Pydantic AI等)有限有限
成本跟踪自动(1050+型号)手动配置手动配置
GPU指标(NVIDIA+AMD)
MCP工具检测是(数据库、缓存、矢量数据库、队列)有限有限
评估(PII、毒性、偏见、幻觉、及时注射)内置(6个探测器)单独服务
OpenTetry原生部分
许可证Apache-2.0Apache-2.0Apache-2.0麻省理工学院

什么被工具化了?

法学硕士提供者(19+)

OpenAI、OpenRouter、Anthropic、Google AI、Google GenAI、AWS Bedrock、Azure OpenAI、Cohere、Mistral AI、Together AI、Groq、Ollama、Vertex AI、Replicate、HuggingFace、SambaNova、Sarvam AI、双曲线、LiteLLM

查看所有提供示例的提供商>>

多代理框架(8)

CrewAI、LangGraph、Google ADK、AutoGen、AutoGen AgentChat、OpenAI代理SDK、Pydantic AI、AWS基岩代理

查看所有带有示例的框架>>

MCP工具(20+)

数据库: PostgreSQL、MySQL、MongoDB、SQLAlchemy、TimescaleDB、OpenSearch、Elasticsearch、FalkorDB 缓存: Redis| 队列: 卡夫卡,拉比MQ| 储存: MinIO 矢量数据库: 松果、Weaviate、Qdrant、ChromaDB、Milvus、FAISS、LanceDB

查看所有MCP工具>>

内置评估(6个探测器)

PII检测(DSGVO/HIPAA/PCI-DSS)、毒性检测、偏差检测、快速注射检测、限制主题、致幻剂检测

查看所有评估功能及其示例>>

截图

OpenAI traces with token usage, costs, and latency

More screenshots

Ollama(当地LLM)

SmolAgents与工具调用

GPU指标

OpenSearch仪表板

主要特点

自动成本跟踪

30多家供应商的1050多种型号,按请求成本细分。支持差别定价(提示与完成)、推理令牌、缓存定价和自定义模型定价。

# Cost tracking is enabled by default - just instrument and go
genai_otel.instrument()

# Or add custom pricing for proprietary models
export GENAI_CUSTOM_PRICING_JSON='{"chat":{"my-model":{"promptPrice":0.001,"completionPrice":0.002}}}'

成本跟踪指南>>

GPU指标(NVIDIA+AMD)

实时监控利用率、内存、温度、功率、PCIe吞吐量、节流和ECC错误。包括多GPU聚合指标。

pip install genai-otel-instrument[gpu]      # NVIDIA
pip install genai-otel-instrument[amd-gpu]  # AMD

GPU指标指南>>

多代理跟踪

具有自动上下文传播的代理框架的完整跨度层次结构:

Crew Execution
  +-- Agent: Senior Researcher (gpt-4)
  |     +-- Task: Research OpenTelemetry
  |           +-- openai.chat.completions (tokens: 1250, cost: $0.03)
  +-- Agent: Technical Writer (ollama:llama2)
        +-- Task: Write blog post
              +-- ollama.chat (tokens: 890, cost: $0.00)

多模态可观测性(v1.1.0)

上的图像、音频、视频和文档内容部分的一流捕获 OpenAI、Anthropic、谷歌Gemini和Groq的跨度。字节已卸载到您的 配置的对象存储(MinIO/S3/文件系统/HTTP),并从引用 span by URI——它们永远不会内联出现在span属性中。

# Opt in (default is off — text-only behaviour is byte-identical to 1.0.x)
export GENAI_OTEL_MEDIA_CAPTURE_MODE=full
export GENAI_OTEL_MEDIA_STORE=minio
export GENAI_OTEL_MEDIA_STORE_ENDPOINT=http://localhost:9000
export GENAI_OTEL_MEDIA_STORE_ACCESS_KEY=...
export GENAI_OTEL_MEDIA_STORE_SECRET_KEY=...
# Optional: plug in a redactor before upload
export GENAI_OTEL_MEDIA_REDACTOR=genai_otel.media.redactors.face_blur

Spans得到相同多模态内容的两个共同发射表示:

  • A. 扁平的、可查询的属性名称空间gen_ai.prompt.{n}.content.{m}.{type, media_uri, media_mime_type, media_byte_size, media_source} 加上a gen_ai.completion.* 镜像——用于索引平面属性的后端。

多式联运指南>>

安全与评估

genai_otel.instrument(
    enable_pii_detection=True,       # GDPR/HIPAA/PCI-DSS compliance
    enable_toxicity_detection=True,  # Perspective API + Detoxify
    enable_bias_detection=True,      # 8 bias categories
    enable_prompt_injection_detection=True,
    enable_hallucination_detection=True,
    enable_restricted_topics=True,
)

50多个示例的评估指南>>

配置

# Required
export OTEL_SERVICE_NAME=my-llm-app
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318

# Optional
export GENAI_ENABLE_GPU_METRICS=true
export GENAI_ENABLE_COST_TRACKING=true
export GENAI_SAMPLING_RATE=0.5                    # Reduce volume in production
export GENAI_ENABLED_INSTRUMENTORS=openai,crewai  # Select specific instrumentors

完整配置参考>>

后端集成

适用于任何与OpenTetry兼容的后端:

Jaeger、Zipkin、Prometheus、Grafana、Datadog、New Relic、Honeycomb、AWS X-Ray、Google Cloud Trace、Elastic APM、Splunk、SigNoz、自托管OTel收集器

预建 Grafana仪表板模板 包括。

示例

90多个现成的示例,涵盖了每个提供者、框架和评估功能:

examples/
+-- openai/              # OpenAI chat, embeddings
+-- anthropic/           # Anthropic + PII/toxicity detection
+-- ollama/              # Local models + all evaluation features
+-- crewai_example.py    # Multi-agent crew orchestration
+-- langgraph_example.py # Stateful graph workflows
+-- google_adk_example.py # Google Agent Development Kit
+-- autogen_example.py   # Microsoft AutoGen agents
+-- pii_detection/       # 10 PII examples (GDPR, HIPAA, PCI-DSS)
+-- toxicity_detection/  # 8 toxicity examples
+-- bias_detection/      # 8 bias examples (hiring compliance, etc.)
+-- prompt_injection/    # 6 injection defense examples
+-- hallucination/       # 4 hallucination detection examples
+-- ...                  # And many more

浏览所有示例>>

开放遥测标准贡献

TraceVerde不仅是OpenTetry GenAI语义约定的消费者,而且该库发现的生产差距正在向上游反馈到规范中 open-telemetry/semantic-conventions-genai:

PR提案状态
#142添加 documentModality 枚举on BlobPart / FilePart / UriPart --PDF、DOCX和其他非图像/视频/音频有效载荷目前采用自由格式 string 支。BFSI KYC提取是一个大容量的真实例子。已批准(@MikeGoldsmith)
#143添加可选 byte_size 在三种媒体部分类型上,这样消费者就可以统一处理有效载荷大小,无论内容是内联、URI还是提供者文件id,这对捕获遥测和存储规划的成本都很有用。派丹蒂克 ge=0 → JSON 模式 "minimum": 0.正在审查中
#144Make content / file_id / uri 可选并添加自由格式 stripped_reason (size_exceeded, modality_not_allowed, redactor_error, upload_error, no_store_configured)因此,仪器可以失败关闭——记录它观察到媒体部分,但故意不捕获其字节——同时保留原始部分 typemodality.通过高层强制执行 anyOf 因此,结构上的空部件无法验证。正在审查中

这三个人都是从封闭的 open-telemetry/semantic-conventions#3673 在GenAI约定于2026年5月5日拆分为专用仓库之后。每个PR都在新回购的V2 Weaver模式下发布,并带有相应的 models.ipynb 更新和 make check-policies / make generate-all 验证。

TraceVerde v1.1.1已经通过双发射在导线上发射了所提出的形状(OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai),为这些公约的实施提供参考。

谁在使用TraceVerde?

TraceVerde被开发人员和团队用于构建生产GenAI应用程序。如果您正在使用TraceVerde,我们很乐意收到您的来信!

社区

许可证

版权所有2025 Kshitij Thakkar。根据 Apache许可证2.0.

目录标签

目录标签

PythonAI代理工作流自动化自动检测本地部署LLMGenAIOpenTelemetry成本跟踪GPU监控

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

token

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiotoken部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP