phoenix-tracing
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePhoenix Tracing
Phoenix追踪
Comprehensive guide for instrumenting LLM applications with OpenInference tracing in Phoenix. Contains rule files covering setup, instrumentation, span types, and production deployment.
在Phoenix中使用OpenInference追踪为LLM应用实现埋点的完整指南。包含涵盖搭建、埋点、Span类型及生产环境部署的规则文件。
When to Apply
适用场景
Reference these guidelines when:
- Setting up Phoenix tracing (Python or TypeScript)
- Creating custom spans for LLM operations
- Adding attributes following OpenInference conventions
- Deploying tracing to production
- Querying and analyzing trace data
在以下场景下参考本指南:
- 搭建Phoenix追踪(Python或TypeScript)
- 为LLM操作创建自定义Span
- 遵循OpenInference约定添加属性
- 将追踪功能部署到生产环境
- 查询与分析追踪数据
Rule Categories
规则分类
| Priority | Category | Description | Prefix |
|---|---|---|---|
| 1 | Setup | Installation and configuration | |
| 2 | Instrumentation | Auto and manual tracing | |
| 3 | Span Types | 9 span kinds with attributes | |
| 4 | Organization | Projects and sessions | |
| 5 | Enrichment | Custom metadata | |
| 6 | Production | Batch processing, masking | |
| 7 | Feedback | Annotations and evaluation | |
| 优先级 | 分类 | 描述 | 前缀 |
|---|---|---|---|
| 1 | 搭建 | 安装与配置 | |
| 2 | 埋点 | 自动与手动追踪 | |
| 3 | Span类型 | 9种带属性的Span类型 | |
| 4 | 组织管理 | 项目与会话 | |
| 5 | 数据增强 | 自定义元数据 | |
| 6 | 生产环境 | 批量处理、数据脱敏 | |
| 7 | 反馈收集 | 标注与评估 | |
Quick Reference
快速参考
1. Setup (START HERE)
1. 搭建(从这里开始)
- - Install arize-phoenix-otel, configure endpoint
setup-python - - Install @arizeai/phoenix-otel, configure endpoint
setup-typescript
- - 安装arize-phoenix-otel,配置端点
setup-python - - 安装@arizeai/phoenix-otel,配置端点
setup-typescript
2. Instrumentation
2. 埋点
- - Auto-instrument OpenAI, LangChain, etc.
instrumentation-auto-python - - Auto-instrument supported frameworks
instrumentation-auto-typescript - - Custom spans with decorators
instrumentation-manual-python - - Custom spans with wrappers
instrumentation-manual-typescript
- - 自动埋点OpenAI、LangChain等框架
instrumentation-auto-python - - 为支持的框架启用自动埋点
instrumentation-auto-typescript - - 使用装饰器添加自定义Span
instrumentation-manual-python - - 使用包装器添加自定义Span
instrumentation-manual-typescript
3. Span Types (with full attribute schemas)
3. Span类型(含完整属性 schema)
- - LLM API calls (model, tokens, messages, cost)
span-llm - - Multi-step workflows and pipelines
span-chain - - Document retrieval (documents, scores)
span-retriever - - Function/API calls (name, parameters)
span-tool - - Multi-step reasoning agents
span-agent - - Vector generation
span-embedding - - Document re-ranking
span-reranker - - Safety checks
span-guardrail - - LLM evaluation
span-evaluator
- - LLM API调用(模型、Token、消息、成本)
span-llm - - 多步骤工作流与流水线
span-chain - - 文档检索(文档、评分)
span-retriever - - 函数/API调用(名称、参数)
span-tool - - 多步骤推理Agent
span-agent - - 向量生成
span-embedding - - 文档重排序
span-reranker - - 安全检查
span-guardrail - - LLM评估
span-evaluator
4. Organization
4. 组织管理
- /
projects-python- Group traces by applicationprojects-typescript - /
sessions-python- Track conversationssessions-typescript
- /
projects-python- 按应用分组追踪数据projects-typescript - /
sessions-python- 追踪对话会话sessions-typescript
5. Enrichment
5. 数据增强
- /
metadata-python- Custom attributesmetadata-typescript
- /
metadata-python- 自定义属性metadata-typescript
6. Production (CRITICAL)
6. 生产环境(关键)
- /
production-python- Batch processing, PII maskingproduction-typescript
- /
production-python- 批量处理、PII脱敏production-typescript
7. Feedback
7. 反馈收集
- - Feedback concepts
annotations-overview - /
annotations-python- Add feedback to spansannotations-typescript
- - 反馈收集概念
annotations-overview - /
annotations-python- 为Span添加反馈annotations-typescript
Reference Files
参考文件
- - Traces, spans, attributes basics
fundamentals-overview - - Required fields per span type
fundamentals-required-attributes - - Common attributes (user.id, session.id)
fundamentals-universal-attributes - - JSON flattening rules
fundamentals-flattening - - Chat message format
attributes-messages - - Custom metadata schema
attributes-metadata - - Agent workflow attributes
attributes-graph - - Error tracking
attributes-exceptions
- - 追踪、Span、属性基础
fundamentals-overview - - 各Span类型的必填字段
fundamentals-required-attributes - - 通用属性(user.id, session.id)
fundamentals-universal-attributes - - JSON扁平化规则
fundamentals-flattening - - 聊天消息格式
attributes-messages - - 自定义元数据 schema
attributes-metadata - - Agent工作流属性
attributes-graph - - 错误追踪
attributes-exceptions
Common Attributes
通用属性
| Attribute | Purpose | Example |
|---|---|---|
| Span type (required) | |
| Operation input | JSON or text |
| Operation output | JSON or text |
| User identifier | |
| Conversation ID | |
| Model identifier | |
| Token usage | |
| Tool/function name | |
| 属性 | 用途 | 示例 |
|---|---|---|
| Span类型(必填) | |
| 操作输入 | JSON或文本 |
| 操作输出 | JSON或文本 |
| 用户标识符 | |
| 对话ID | |
| 模型标识符 | |
| Token用量 | |
| 工具/函数名称 | |
Common Workflows
常见工作流
Quick Start:
- → Install and configure
setup-{lang} - → Enable auto-instrumentation
instrumentation-auto-{lang} - Check Phoenix for traces
Custom Spans:
- → Install
setup-{lang} - → Add decorators/wrappers
instrumentation-manual-{lang} - → Reference attributes
span-{type}
Production: → Configure batching and masking
production-{lang}快速开始:
- → 安装与配置
setup-{lang} - → 启用自动埋点
instrumentation-auto-{lang} - 在Phoenix中查看追踪数据
自定义Span:
- → 安装
setup-{lang} - → 添加装饰器/包装器
instrumentation-manual-{lang} - → 参考属性规范
span-{type}
生产环境: → 配置批量处理与脱敏
production-{lang}How to Use
使用方法
Read individual rule files in for detailed explanations and examples:
rules/rules/setup-python.md
rules/instrumentation-manual-typescript.md
rules/span-llm.mdUse file prefixes to find what you need:
bash
ls rules/span-* # Span type specifications
ls rules/*-python.md # Python guides
ls rules/*-typescript.md # TypeScript guides阅读目录下的单个规则文件获取详细说明与示例:
rules/rules/setup-python.md
rules/instrumentation-manual-typescript.md
rules/span-llm.md通过文件前缀查找所需内容:
bash
ls rules/span-* # Span类型规范
ls rules/*-python.md # Python指南
ls rules/*-typescript.md # TypeScript指南References
参考链接
Phoenix Documentation:
Python API Documentation:
- Python OTEL Package - API reference
arize-phoenix-otel - Python Client Package - API reference
arize-phoenix-client
TypeScript API Documentation:
- TypeScript Packages - ,
@arizeai/phoenix-otel, and other TypeScript packages@arizeai/phoenix-client
Phoenix文档:
Python API文档:
- Python OTEL Package - API参考
arize-phoenix-otel - Python Client Package - API参考
arize-phoenix-client
TypeScript API文档:
- TypeScript Packages - 、
@arizeai/phoenix-otel及其他TypeScript包@arizeai/phoenix-client