feat: add more otel services

This commit is contained in:
Sun-ZhenXing
2026-01-11 23:42:34 +08:00
parent ea5eadfcec
commit 51fd7ea08b
28 changed files with 2358 additions and 70 deletions

View File

@@ -1,18 +1,23 @@
# Compose Profiles
# Toggle between 'sqlite' (default) and 'postgres' (or 'pg')
COMPOSE_PROFILES=sqlite
# Phoenix version
PHOENIX_VERSION=12.27.0-nonroot
PHOENIX_VERSION=12.28.1-nonroot
# Timezone
TZ=UTC
# Phoenix ports
PHOENIX_PORT_OVERRIDE=6006 # UI and OTLP HTTP collector
PHOENIX_GRPC_PORT_OVERRIDE=4317 # OTLP gRPC collector
PHOENIX_PORT_OVERRIDE=6006 # UI and OTLP HTTP collector
PHOENIX_GRPC_PORT_OVERRIDE=4317 # OTLP gRPC collector
PHOENIX_PROMETHEUS_PORT_OVERRIDE=9090 # Prometheus metrics (optional)
# Phoenix configuration
PHOENIX_ENABLE_PROMETHEUS=false
PHOENIX_SECRET= # Optional: Set for authentication, generate with: openssl rand -base64 32
# PostgreSQL configuration
# PostgreSQL configuration (only used when COMPOSE_PROFILES=postgres)
POSTGRES_VERSION=17.2-alpine3.21
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres

View File

@@ -6,8 +6,18 @@ Arize Phoenix is an open-source AI observability platform for LLM applications.
## Services
- `phoenix`: The main Phoenix application server with UI and OpenTelemetry collectors.
- `phoenix-db`: PostgreSQL database for persistent storage.
- `phoenix`: The main Phoenix application server (SQLite version).
- `phoenix-pg`: The Phoenix application server configured for PostgreSQL (requires `postgres` profile).
- `phoenix-db`: PostgreSQL database for persistent storage (requires `postgres` profile).
## Profiles
This project supports two modes of operation via Docker Compose profiles:
1. **sqlite** (Default): Uses SQLite for storage. Simple and good for local development.
Set `COMPOSE_PROFILES=sqlite` in `.env`.
2. **postgres** (or **pg**): Uses PostgreSQL for storage. Recommended for production.
Set `COMPOSE_PROFILES=postgres` in `.env`.
## Ports
@@ -15,24 +25,28 @@ Arize Phoenix is an open-source AI observability platform for LLM applications.
| ---- | -------- | ----------------------------------------- |
| 6006 | HTTP | UI and OTLP HTTP collector (`/v1/traces`) |
| 4317 | gRPC | OTLP gRPC collector |
| 9090 | HTTP | Prometheus metrics (optional) |
## Environment Variables
| Variable Name | Description | Default Value |
| -------------------------- | ------------------------------------- | ----------------- |
| PHOENIX_VERSION | Phoenix image version | `12.27.0-nonroot` |
| PHOENIX_PORT_OVERRIDE | Host port for Phoenix UI and HTTP API | `6006` |
| PHOENIX_GRPC_PORT_OVERRIDE | Host port for OTLP gRPC collector | `4317` |
| PHOENIX_ENABLE_PROMETHEUS | Enable Prometheus metrics endpoint | `false` |
| PHOENIX_SECRET | Secret for authentication (optional) | `""` |
| POSTGRES_VERSION | PostgreSQL image version | `17.2-alpine3.21` |
| POSTGRES_USER | PostgreSQL username | `postgres` |
| POSTGRES_PASSWORD | PostgreSQL password | `postgres` |
| POSTGRES_DB | PostgreSQL database name | `phoenix` |
| Variable Name | Description | Default Value |
| -------------------------------- | ---------------------------------------- | ----------------- |
| COMPOSE_PROFILES | Active profiles (`sqlite` or `postgres`) | `sqlite` |
| PHOENIX_VERSION | Phoenix image version | `12.28.1-nonroot` |
| PHOENIX_PORT_OVERRIDE | Host port for Phoenix UI and HTTP API | `6006` |
| PHOENIX_GRPC_PORT_OVERRIDE | Host port for OTLP gRPC collector | `4317` |
| PHOENIX_PROMETHEUS_PORT_OVERRIDE | Host port for Prometheus metrics | `9090` |
| PHOENIX_ENABLE_PROMETHEUS | Enable Prometheus metrics endpoint | `false` |
| PHOENIX_SECRET | Secret for authentication (optional) | `""` |
| POSTGRES_VERSION | PostgreSQL image version | `17.2-alpine3.21` |
| POSTGRES_USER | PostgreSQL username | `postgres` |
| POSTGRES_PASSWORD | PostgreSQL password | `postgres` |
| POSTGRES_DB | PostgreSQL database name | `phoenix` |
## Volumes
- `phoenix_db_data`: PostgreSQL data volume for persistent storage.
- `phoenix_data`: Data volume for SQLite mode (mounted to `/data`).
- `phoenix_db_data`: Data volume for PostgreSQL mode.
## Getting Started
@@ -42,11 +56,20 @@ Arize Phoenix is an open-source AI observability platform for LLM applications.
cp .env.example .env
```
2. (Optional) For production, set a secure password and secret:
2. Select your deployment mode by editing `.env` (default is `sqlite`).
```bash
# Generate a secret for authentication
openssl rand -base64 32
**For SQLite (Default):**
Ensure `.env` contains:
```dotenv
COMPOSE_PROFILES=sqlite
```
**For PostgreSQL:**
Change `.env` to:
```dotenv
COMPOSE_PROFILES=postgres
```
3. Start the services:

View File

@@ -6,8 +6,18 @@ Arize Phoenix 是一个开源的 AI 可观测性平台,专为 LLM 应用设计
## 服务
- `phoenix`Phoenix 主应用服务器,包含 UI 和 OpenTelemetry 采集器
- `phoenix-db`:用于持久化存储的 PostgreSQL 数据库
- `phoenix`Phoenix 主应用服务器SQLite 版本)
- `phoenix-pg`配置为使用 PostgreSQL 的 Phoenix 应用服务器(需要 `postgres` 配置文件)
- `phoenix-db`:用于持久化存储的 PostgreSQL 数据库(需要 `postgres` 配置文件)。
## 配置文件 (Profiles)
本项目支持通过 Docker Compose 配置文件使用两种运行模式:
1. **sqlite**(默认):使用 SQLite 存储。简单易用,适合本地开发。
`.env` 中设置 `COMPOSE_PROFILES=sqlite`
2. **postgres**(或 **pg**):使用 PostgreSQL 存储。推荐用于生产环境。
`.env` 中设置 `COMPOSE_PROFILES=postgres`
## 端口
@@ -15,24 +25,28 @@ Arize Phoenix 是一个开源的 AI 可观测性平台,专为 LLM 应用设计
| ---- | ---- | -------------------------------------- |
| 6006 | HTTP | UI 和 OTLP HTTP 采集器(`/v1/traces` |
| 4317 | gRPC | OTLP gRPC 采集器 |
| 9090 | HTTP | Prometheus 指标(可选) |
## 环境变量
| 变量名 | 描述 | 默认值 |
| -------------------------- | --------------------------------- | ----------------- |
| PHOENIX_VERSION | Phoenix 镜像版本 | `12.27.0-nonroot` |
| PHOENIX_PORT_OVERRIDE | Phoenix UI 和 HTTP API 的主机端口 | `6006` |
| PHOENIX_GRPC_PORT_OVERRIDE | OTLP gRPC 采集器的主机端口 | `4317` |
| PHOENIX_ENABLE_PROMETHEUS | 启用 Prometheus 指标端点 | `false` |
| PHOENIX_SECRET | 认证密钥(可选) | `""` |
| POSTGRES_VERSION | PostgreSQL 镜像版本 | `17.2-alpine3.21` |
| POSTGRES_USER | PostgreSQL 用户名 | `postgres` |
| POSTGRES_PASSWORD | PostgreSQL 密码 | `postgres` |
| POSTGRES_DB | PostgreSQL 数据库名 | `phoenix` |
| 变量名 | 描述 | 默认值 |
| -------------------------------- | ---------------------------------------- | ----------------- |
| COMPOSE_PROFILES | 激活的配置文件(`sqlite``postgres` | `sqlite` |
| PHOENIX_VERSION | Phoenix 镜像版本 | `12.28.1-nonroot` |
| PHOENIX_PORT_OVERRIDE | Phoenix UI 和 HTTP API 的主机端口 | `6006` |
| PHOENIX_GRPC_PORT_OVERRIDE | OTLP gRPC 采集器的主机端口 | `4317` |
| PHOENIX_PROMETHEUS_PORT_OVERRIDE | Prometheus 指标的主机端口 | `9090` |
| PHOENIX_ENABLE_PROMETHEUS | 启用 Prometheus 指标端点 | `false` |
| PHOENIX_SECRET | 认证密钥(可选) | `""` |
| POSTGRES_VERSION | PostgreSQL 镜像版本 | `17.2-alpine3.21` |
| POSTGRES_USER | PostgreSQL 用户名 | `postgres` |
| POSTGRES_PASSWORD | PostgreSQL 密码 | `postgres` |
| POSTGRES_DB | PostgreSQL 数据库名 | `phoenix` |
## 数据卷
- `phoenix_db_data`PostgreSQL 数据卷,用于持久化存储
- `phoenix_data`SQLite 模式的数据卷(挂载到 `/data`
- `phoenix_db_data`PostgreSQL 模式的数据卷。
## 快速开始
@@ -42,11 +56,20 @@ Arize Phoenix 是一个开源的 AI 可观测性平台,专为 LLM 应用设计
cp .env.example .env
```
2. (可选)生产环境下,请设置安全的密码和密钥:
2. 通过编辑 `.env` 选择部署模式(默认为 `sqlite`)。
```bash
# 生成认证密钥
openssl rand -base64 32
**使用 SQLite默认**
确保 `.env` 包含:
```dotenv
COMPOSE_PROFILES=sqlite
```
**使用 PostgreSQL**
将 `.env` 修改为:
```dotenv
COMPOSE_PROFILES=postgres
```
3. 启动服务:

View File

@@ -9,38 +9,69 @@ x-defaults: &defaults
max-size: 100m
max-file: "3"
x-phoenix-common: &phoenix-common
<<: *defaults
image: ${GLOBAL_REGISTRY:-}arizephoenix/phoenix:${PHOENIX_VERSION:-12.28.1-nonroot}
ports:
- "${PHOENIX_PORT_OVERRIDE:-6006}:6006" # UI and OTLP HTTP collector
- "${PHOENIX_GRPC_PORT_OVERRIDE:-4317}:4317" # OTLP gRPC collector
- "${PHOENIX_PROMETHEUS_PORT_OVERRIDE:-9090}:9090" # Prometheus metrics
environment:
- TZ=${TZ:-UTC}
- PHOENIX_ENABLE_PROMETHEUS=${PHOENIX_ENABLE_PROMETHEUS:-false}
- PHOENIX_SECRET=${PHOENIX_SECRET:-}
healthcheck:
test:
[
"CMD",
"python3",
"-c",
"import httpx;r=httpx.get('http://localhost:6006/healthz').raise_for_status()",
]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
deploy:
resources:
limits:
cpus: ${PHOENIX_CPU_LIMIT:-2.0}
memory: ${PHOENIX_MEMORY_LIMIT:-2G}
reservations:
cpus: ${PHOENIX_CPU_RESERVATION:-0.5}
memory: ${PHOENIX_MEMORY_RESERVATION:-512M}
services:
# Default SQLite configuration
phoenix:
<<: *defaults
image: ${GLOBAL_REGISTRY:-}arizephoenix/phoenix:${PHOENIX_VERSION:-12.27.0-nonroot}
ports:
- "${PHOENIX_PORT_OVERRIDE:-6006}:6006" # UI and OTLP HTTP collector
- "${PHOENIX_GRPC_PORT_OVERRIDE:-4317}:4317" # OTLP gRPC collector
<<: *phoenix-common
profiles:
- sqlite
- ${COMPOSE_PROFILES:-}
environment:
- TZ=${TZ:-UTC}
- PHOENIX_SQL_DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@phoenix-db:5432/${POSTGRES_DB:-phoenix}
- PHOENIX_ENABLE_PROMETHEUS=${PHOENIX_ENABLE_PROMETHEUS:-false}
- PHOENIX_SECRET=${PHOENIX_SECRET:-}
- PHOENIX_WORKING_DIR=/data
volumes:
- phoenix_data:/data
# PostgreSQL configuration
phoenix-pg:
<<: *phoenix-common
profiles: ["postgres", "pg"]
environment:
- TZ=${TZ:-UTC}
- PHOENIX_ENABLE_PROMETHEUS=${PHOENIX_ENABLE_PROMETHEUS:-false}
- PHOENIX_SECRET=${PHOENIX_SECRET:-}
- PHOENIX_SQL_DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@phoenix-db:5432/${POSTGRES_DB:-phoenix}
depends_on:
phoenix-db:
condition: service_healthy
healthcheck:
test: ["CMD", "python3", "-c", "import httpx;r=httpx.get('http://localhost:6006/healthz').raise_for_status()"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
deploy:
resources:
limits:
cpus: ${PHOENIX_CPU_LIMIT:-2.0}
memory: ${PHOENIX_MEMORY_LIMIT:-2G}
reservations:
cpus: ${PHOENIX_CPU_RESERVATION:-0.5}
memory: ${PHOENIX_MEMORY_RESERVATION:-512M}
phoenix-db:
<<: *defaults
profiles: ["postgres", "pg"]
image: ${GLOBAL_REGISTRY:-}postgres:${POSTGRES_VERSION:-17.2-alpine3.21}
environment:
- TZ=${TZ:-UTC}
@@ -65,4 +96,5 @@ services:
memory: ${PHOENIX_DB_MEMORY_RESERVATION:-256M}
volumes:
phoenix_data:
phoenix_db_data: