系統端點
端點總覽
| Endpoint | 用途 | Auth |
|---|---|---|
GET /healthz | liveness probe | 無 |
GET /readyz | readiness probe | 無 |
GET /metrics | 主 HTTP process 的 Prometheus metrics | 無 |
GET :WORKER_METRICS_PORT/healthz | worker-only process 的 liveness | 無 |
GET :WORKER_METRICS_PORT/metrics | worker-only process 的 Prometheus metrics | 無 |
WORKER_METRICS_PORT 的預設值與驗證規則,請見 設定。
GET /healthz
只要 process 活著就回:
200 OK
OK
適合用於 liveness probe,不代表下游依賴已就緒。
GET /readyz
/readyz 會在 2 秒 timeout 內依序檢查:
- PostgreSQL
- Redis
- source bucket
- media bucket
curl 範例
curl -i http://localhost:3000/readyz
成功:
200 OK
OK
失敗時會回 503 Service Unavailable,body 會指出是哪個依賴失敗,例如:
not ready: redis: dial tcp 127.0.0.1:6381: connect: connection refused
GET /metrics
主 HTTP process 的 metrics 由 /metrics 暴露。典型 metric families 包括:
vylux_http_requests_totalvylux_http_request_duration_secondsvylux_image_cache_events_totalvylux_image_results_totalvylux_image_errors_totalvylux_worker_tasks_totalvylux_worker_task_duration_secondsvylux_readiness_failures_totalvylux_queue_tasksvylux_queue_metrics_sync_failures_total
curl 範例
curl -s http://localhost:3000/metrics | rg '^vylux_'
worker-only metrics listener
當你以 --mode=worker 啟動 Vylux,worker 會另外開一個輕量 listener:
- port:
WORKER_METRICS_PORT,預設3001 - endpoints:
/healthz、/metrics WORKER_METRICS_PORT=0時停用
這讓 K8s 或其他平台可以把 worker 跟 HTTP server 分開探測與抓取 metrics。
追蹤 header
除了 metrics 外,HTTP request 與 webhook/callback 也會攜帶 tracing 資訊:
traceparenttracestateX-Trace-ID
X-Trace-ID 適合人工除錯與日誌關聯;真正的 trace context 仍以 W3C Trace Context headers 為主。