Add Phoenix OTLP tracing and LLM span attributes

This commit is contained in:
dahyeon committed 2026-05-18 21:09:08 -07:00
1 parent f15459bb99
commit 1d0be56842
11 files changed
+244 -17

No files matched your search

+29 -2
View File
@@ -461,6 +461,8 @@ npm test
| `PROMPT_VARIANT_ID` | unset | 운영 prompt variant 선택 |
| `AGENT_ROUTER_WEIGHTS_PATH` | unset | learned router weights path |
| `AGENT_SUPERVISOR_LLM_RESPONSE_ENABLED` | true | supervisor LLM userMessage 사용 여부 |
| `PHOENIX_OTLP_ENDPOINT` | unset | Phoenix OTLP trace endpoint |
| `PHOENIX_LOG_PROMPTS` | false | LLM prompt/completion content trace 기록 |
| `METRICS_PORT` | 9464 | Prometheus `/metrics` HTTP endpoint port |
| `SLACK_ALERT_WEBHOOK_URL` | unset | alert Slack incoming webhook URL |
| `SLACK_WEBHOOK_TIMEOUT_MS` | 3000 | Slack webhook POST timeout |
@@ -517,7 +519,32 @@ ALERT_THRESHOLD_DRIFT_PCT=15
예를 들어 onboarding latency alert와 moderation latency alert는 서로 throttle하지 않는다.
skill이 없는 cross-system alert는 기존처럼 글로벌 dedupe를 사용한다.
### 16.2 Prometheus scrape
### 16.2 Phoenix trace
LLM 호출, skill 실행, tool 실행 span은 OpenTelemetry trace로 남긴다.
`PHOENIX_OTLP_ENDPOINT`가 없으면 기존 설정을 따른다. 개발 환경 기본값은 trace exporter 비활성화이고, `OTEL_EXPORTER=stdout`이면 콘솔 exporter를 쓴다.
Phoenix를 로컬에서 볼 때:
```bash
docker run --rm -p 6006:6006 arizephoenix/phoenix:latest
```
Agent/worker env:
```env
PHOENIX_OTLP_ENDPOINT=http://localhost:6006/v1/traces
OTEL_SAMPLING_RATIO=1
PHOENIX_LOG_PROMPTS=false
```
`PHOENIX_OTLP_ENDPOINT`가 설정되면 `OTEL_EXPORTER=none`이어도 Phoenix OTLP exporter를 우선 사용한다.
Phoenix UI에서는 `service.name=lolympus-agent`, `gen_ai.system`, `gen_ai.request.model`, `gen_ai.usage.cost_usd`, `llm.token_count.prompt`, `llm.token_count.completion` 속성으로 LLM span을 필터링한다.
Prompt와 completion 본문은 기본적으로 기록하지 않는다.
디버깅 때문에 필요할 때만 `PHOENIX_LOG_PROMPTS=true`를 켠다. 이 경우 email, 전화번호, token/API key 형태의 값은 span 기록 전에 masking된다.
### 16.3 Prometheus scrape
Agent process는 `METRICS_PORT`에서 HTTP endpoint를 연다.
@@ -569,7 +596,7 @@ sum by (skill, stage) (rate(agent_validator_fail_total[5m]))
| eval drift | 15% 이하 |
| archive stalled | 3회 연속 실패 0건 |
### 16.3 Slack webhook 설정
### 16.4 Slack webhook 설정
Slack incoming webhook URL을 env로 설정한다.