---
id: daily-phoenix-tracing
name: "phoenix-tracing"
url: https://skills.yangsir.net/skill/daily-phoenix-tracing
author: github
domain: ai-system-observability-sre
tags: ["tracing", "observability", "llm", "opentelemetry", "phoenix"]
install_count: 1000
rating: 4.30 (4 reviews)
github: https://github.com/github/awesome-copilot
---

# phoenix-tracing

> 使用 OpenTelemetry 为 LLM 应用添加可观测性，自动追踪 traces、spans 和指标

**Stats**: 1,000 installs · 4.3/5 (4 reviews)

## Before / After 对比

### LLM应用可观测性追踪

**Before**:

在没有 `phoenix-tracing` 的情况下，为 LLM 应用添加可观测性通常需要大量手动工作。开发者需要自行编写代码来记录每次 LLM API 调用（如 OpenAI 或 LangChain）的详细信息，包括请求、响应、使用的模型、输入/输出令牌数量以及预估成本。对于多步骤的 LLM 工作流（如 RAG 链），需要手动关联不同阶段的日志，才能理解整个流程的执行路径和性能瓶颈。这导致调试复杂、问题定位耗时，且难以获得统一、标准化的追踪视图，尤其是在生产环境中。

**After**:

通过集成 `phoenix-tracing`，LLM 应用的可观测性得到了显著提升。它能自动对 OpenAI、LangChain 等主流框架进行追踪，无需手动修改代码即可捕获 LLM API 调用和多步骤工作流（如 `span-llm` 和 `span-chain`）。系统会自动记录关键属性，如模型名称、令牌使用量、消息内容和成本。这使得开发者能够轻松地查看完整的端到端追踪，快速识别性能瓶颈、调试错误，并分析 LLM 交互的效率和成本，从而大幅简化了 LLM 应用的开发、部署和维护。

| Metric | Before | After | Change |
|---|---|---|---|
| LLM应用问题定位时间 | 120分钟 | 15分钟 | -87.5% |
| LLM交互追踪覆盖率 | 30% | 95% | +216.67% |
| 观测代码维护量 | 150行 | 20行 | -86.67% |

## Readme

# phoenix-tracing

# Phoenix Tracing

Comprehensive guide for instrumenting LLM applications with OpenInference tracing in Phoenix. Contains reference files covering setup, instrumentation, span types, and production deployment.

## 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

## Reference Categories

Priority
Category
Description
Prefix

1
Setup
Installation and configuration
`setup-*`

2
Instrumentation
Auto and manual tracing
`instrumentation-*`

3
Span Types
9 span kinds with attributes
`span-*`

4
Organization
Projects and sessions
`projects-*`, `sessions-*`

5
Enrichment
Custom metadata
`metadata-*`

6
Production
Batch processing, masking
`production-*`

7
Feedback
Annotations and evaluation
`annotations-*`

## Quick Reference

### 1. Setup (START HERE)

- [setup-python](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/setup-python.md) - Install arize-phoenix-otel, configure endpoint

- [setup-typescript](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/setup-typescript.md) - Install @arizeai/phoenix-otel, configure endpoint

### 2. Instrumentation

- [instrumentation-auto-python](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/instrumentation-auto-python.md) - Auto-instrument OpenAI, LangChain, etc.

- [instrumentation-auto-typescript](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/instrumentation-auto-typescript.md) - Auto-instrument supported frameworks

- [instrumentation-manual-python](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/instrumentation-manual-python.md) - Custom spans with decorators

- [instrumentation-manual-typescript](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/instrumentation-manual-typescript.md) - Custom spans with wrappers

### 3. Span Types (with full attribute schemas)

- [span-llm](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/span-llm.md) - LLM API calls (model, tokens, messages, cost)

- [span-chain](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/span-chain.md) - Multi-step workflows and pipelines

- [span-retriever](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/span-retriever.md) - Document retrieval (documents, scores)

- [span-tool](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/span-tool.md) - Function/API calls (name, parameters)

- [span-agent](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/span-agent.md) - Multi-step reasoning agents

- [span-embedding](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/span-embedding.md) - Vector generation

- [span-reranker](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/span-reranker.md) - Document re-ranking

- [span-guardrail](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/span-guardrail.md) - Safety checks

- [span-evaluator](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/span-evaluator.md) - LLM evaluation

### 4. Organization

- [projects-python](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/projects-python.md) / [projects-typescript](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/projects-typescript.md) - Group traces by application

- [sessions-python](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/sessions-python.md) / [sessions-typescript](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/sessions-typescript.md) - Track conversations

### 5. Enrichment

- [metadata-python](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/metadata-python.md) / [metadata-typescript](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/metadata-typescript.md) - Custom attributes

### 6. Production (CRITICAL)

- [production-python](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/production-python.md) / [production-typescript](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/production-typescript.md) - Batch processing, PII masking

### 7. Feedback

- [annotations-overview](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/annotations-overview.md) - Feedback concepts

- [annotations-python](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/annotations-python.md) / [annotations-typescript](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/annotations-typescript.md) - Add feedback to spans

### Reference Files

- [fundamentals-overview](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/fundamentals-overview.md) - Traces, spans, attributes basics

- [fundamentals-required-attributes](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/fundamentals-required-attributes.md) - Required fields per span type

- [fundamentals-universal-attributes](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/fundamentals-universal-attributes.md) - Common attributes (user.id, session.id)

- [fundamentals-flattening](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/fundamentals-flattening.md) - JSON flattening rules

- [attributes-messages](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/attributes-messages.md) - Chat message format

- [attributes-metadata](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/attributes-metadata.md) - Custom metadata schema

- [attributes-graph](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/attributes-graph.md) - Agent workflow attributes

- [attributes-exceptions](https://github.com/github/awesome-copilot/blob/HEAD/skills/phoenix-tracing/references/attributes-exceptions.md) - Error tracking

## Common Workflows

- **Quick Start**: setup-{lang} → instrumentation-auto-{lang} → Check Phoenix

- **Custom Spans**: setup-{lang} → instrumentation-manual-{lang} → span-{type}

- **Session Tracking**: sessions-{lang} for conversation grouping patterns

- **Production**: production-{lang} for batching, masking, and deployment

## How to Use This Skill

**Navigation Patterns:**

```
# By category prefix
references/setup-*              # Installation and configuration
references/instrumentation-*    # Auto and manual tracing
references/span-*               # Span type specifications
references/sessions-*           # Session tracking
references/production-*         # Production deployment
references/fundamentals-*       # Core concepts
references/attributes-*         # Attribute specifications

# By language
references/*-python.md          # Python implementations
references/*-typescript.md      # TypeScript implementations

```

**Reading Order:**

- Start with setup-{lang} for your language

- Choose instrumentation-auto-{lang} OR instrumentation-manual-{lang}

- Reference span-{type} files as needed for specific operations

- See fundamentals-* files for attribute specifications

## References

**Phoenix Documentation:**

- [Phoenix Documentation](https://docs.arize.com/phoenix)

- [OpenInference Spec](https://github.com/Arize-ai/openinference/tree/main/spec)

**Python API Documentation:**

- [Python OTEL Package](https://arize-phoenix.readthedocs.io/projects/otel/en/latest/) - `arize-phoenix-otel` API reference

- [Python Client Package](https://arize-phoenix.readthedocs.io/projects/client/en/latest/) - `arize-phoenix-client` API reference

**TypeScript API Documentation:**

- [TypeScript Packages](https://arize-ai.github.io/phoenix/) - `@arizeai/phoenix-otel`, `@arizeai/phoenix-client`, and other TypeScript packages

Weekly Installs522Repository[github/awesome-copilot](https://github.com/github/awesome-copilot)GitHub Stars29.6KFirst Seen12 days agoSecurity Audits[Gen Agent Trust HubPass](/github/awesome-copilot/phoenix-tracing/security/agent-trust-hub)[SocketPass](/github/awesome-copilot/phoenix-tracing/security/socket)[SnykPass](/github/awesome-copilot/phoenix-tracing/security/snyk)Installed onopencode479codex477gemini-cli476github-copilot476kimi-cli473deepagents473

---
*Source: https://skills.yangsir.net/skill/daily-phoenix-tracing*
*Markdown mirror: https://skills.yangsir.net/api/skill/daily-phoenix-tracing/markdown*