Files
life-echo/api/docker-compose.observability.yml

123 lines
3.6 KiB
YAML
Raw Permalink Normal View History

feat: OpenTelemetry LGTM observability, dev tooling, and memoir UX fixes (#31) * add staging ios app build script * feat(api): add OpenTelemetry LGTM stack for local observability Wire OTel traces, metrics, and logs through a collector to Tempo, Prometheus, and Loki, with custom LLM instrumentation, dev compose overlay, Grafana provisioning, env templates, and development.sh auto-start. Co-authored-by: Cursor <cursoragent@cursor.com> * feat: expand observability, harden dev tooling, and fix expo staging UX Add business and LLM Prometheus metrics with Grafana dashboards, alerting, and a metrics verification script. Wire telemetry through adapters and core LLM paths, and document the local LGTM workflow. Fix development.sh for macOS bash 3.2, open Grafana and eval-web in Chrome, and repair eval-web auto-open (unbound EVAL_WEB_BROWSER_SCHEDULED). Merge internal-eval into the main dev script with improved compose handling. Require EXPO_PUBLIC_* at build time, improve iOS HTTP ATS for staging IPs, show memoir empty state instead of load errors when no chapters exist, and add jest env setup plus chapter list response normalization. Co-authored-by: Cursor <cursoragent@cursor.com> * chore: enable Grafana Assistant Cursor plugin Co-authored-by: Cursor <cursoragent@cursor.com> * fix: memoir empty state and repair withdrawn 0020_chapters_book_id stamp Show empty memoir UI when the chapter list succeeds with no items; treat auth/404 as non-fatal. Extend alembic revision repair so local dev DBs stamped with the removed 0020_chapters_book_id migration can roll back and upgrade to 0019. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Kevin <kevin@brighteng.org> Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-20 15:12:21 +08:00
# 本地可观测性栈 overlay与 docker-compose.dev.yml 一起使用)
#
# docker compose -f docker-compose.dev.yml -f docker-compose.observability.yml up -d
#
# 宿主机端口刻意避开 3000/9090/4317 等常用口,与 .env.example 中 OTEL_* / *_HOST_PORT 对齐。
# Grafana: http://127.0.0.1:${GRAFANA_HOST_PORT:-48300} (admin / admin)
# OTLP: 127.0.0.1:${OTEL_GRPC_HOST_PORT:-48317} (gRPC) :${OTEL_HTTP_HOST_PORT:-48318} (HTTP)
services:
otel-collector:
image: otel/opentelemetry-collector-contrib:0.120.0
container_name: life-echo-otel-collector
command: ["--config=/etc/otelcol/config.yaml"]
volumes:
- ./deploy/observability/otel-collector-config.yaml:/etc/otelcol/config.yaml:ro
ports:
- "127.0.0.1:${OTEL_GRPC_HOST_PORT:-48317}:4317"
- "127.0.0.1:${OTEL_HTTP_HOST_PORT:-48318}:4318"
- "127.0.0.1:${OTEL_COLLECTOR_HEALTH_HOST_PORT:-48333}:13133"
depends_on:
tempo:
condition: service_started
loki:
condition: service_started
networks:
- default
restart: unless-stopped
tempo:
image: grafana/tempo:2.7.2
container_name: life-echo-tempo
command: ["-config.file=/etc/tempo.yaml"]
volumes:
- ./deploy/observability/tempo.yaml:/etc/tempo.yaml:ro
- tempo_data:/var/tempo
ports:
- "127.0.0.1:${TEMPO_HTTP_HOST_PORT:-43200}:3200"
networks:
- default
restart: unless-stopped
loki:
image: grafana/loki:3.4.2
container_name: life-echo-loki
command: ["-config.file=/etc/loki/loki-config.yaml"]
volumes:
- ./deploy/observability/loki-config.yaml:/etc/loki/loki-config.yaml:ro
- loki_data:/loki
ports:
- "127.0.0.1:${LOKI_HTTP_HOST_PORT:-43100}:3100"
networks:
- default
restart: unless-stopped
promtail:
image: grafana/promtail:3.4.2
container_name: life-echo-promtail
command: ["-config.file=/etc/promtail/config.yml"]
volumes:
- ./deploy/observability/promtail-config.yaml:/etc/promtail/config.yml:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
depends_on:
loki:
condition: service_started
networks:
- default
restart: unless-stopped
prometheus:
image: prom/prometheus:v3.2.1
container_name: life-echo-prometheus
command:
- --config.file=/etc/prometheus/prometheus.yml
- --storage.tsdb.path=/prometheus
- --web.enable-lifecycle
volumes:
- ./deploy/observability/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
ports:
- "127.0.0.1:${PROMETHEUS_HOST_PORT:-49090}:9090"
depends_on:
otel-collector:
condition: service_started
networks:
- default
restart: unless-stopped
grafana:
image: grafana/grafana:11.5.2
container_name: life-echo-grafana
environment:
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: admin
GF_USERS_ALLOW_SIGN_UP: "false"
GF_AUTH_ANONYMOUS_ENABLED: "false"
volumes:
- ./deploy/observability/grafana/provisioning:/etc/grafana/provisioning:ro
- ./deploy/observability/grafana/dashboards:/etc/grafana/dashboards:ro
- grafana_data:/var/lib/grafana
ports:
- "127.0.0.1:${GRAFANA_HOST_PORT:-48300}:3000"
depends_on:
prometheus:
condition: service_started
tempo:
condition: service_started
loki:
condition: service_started
networks:
- default
restart: unless-stopped
volumes:
tempo_data:
loki_data:
prometheus_data:
grafana_data:
networks:
default:
name: life-echo-dev
external: true