imks/.env.example
zhenyi 0dbac480ae feat(telemetry): integrate OpenTelemetry observability stack with health metrics
- Add OpenTelemetry SDK, OTLP exporter, Prometheus integration
- Implement connection tracking with active/total/disconnection metrics
- Add health endpoint with uptime and connection counts
- Integrate tracing spans for socket events and engine messages
- Add metrics collection for event handling duration
- Update health endpoint to include live runtime state
- Add graceful telemetry shutdown in main function
- Implement engine session active metrics tracking
- Add namespace-specific attributes to connection metrics
- Introduce message edit history retrieval endpoint
- Add scheduled message CRUD operations and dispatcher
- Update Socket.IO event registration with observability
- Refactor component update to remove dead code allowance
- Add comprehensive environment variables documentation
- Implement detailed development guidelines in AGENTS.md
2026-06-11 13:53:29 +08:00

72 lines
2.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# =============================================================================
# imks — IM 实时消息服务 环境变量配置
# 复制此文件为 .env 并修改相应值
# =============================================================================
# --- 部署模式 ---
# Adapter 模式: "local" (单节点) | "redis" | "nats"
IMKS_ADAPTER=local
# 当前节点唯一标识(默认取主机名)
# IMKS_SERVER_ID=imks-node-1
# Redis 连接IMKS_ADAPTER=redis 时必需)
# IMKS_REDIS_URL=redis://localhost:6379
# NATS 连接IMKS_ADAPTER=nats 时必需)
# IMKS_NATS_URL=nats://localhost:4222
# --- WebTransport (QUIC) ---
# 启用 WebTransport 服务(需要 TLS 证书)
# IMKS_WT_ENABLED=false
# IMKS_WT_PORT=3001
# IMKS_WT_CERT_PATH=/path/to/cert.pem
# IMKS_WT_KEY_PATH=/path/to/key.pem
# --- 数据库 ---
# PostgreSQL 连接字符串
# DATABASE_URL=postgres://imks:password@localhost:5432/imks
DATABASE_URL=postgres://localhost/imks
# 连接池配置
# DATABASE_MAX_CONNECTIONS=10
# DATABASE_MIN_CONNECTIONS=2
# DATABASE_CONNECT_TIMEOUT=30
# DATABASE_IDLE_TIMEOUT=600
# --- appks gRPC 连接 ---
# appks 核心服务地址
# APPKS_GRPC_ADDR=http://localhost:50051
# 连接超时(秒)
# APPKS_GRPC_TIMEOUT=10
# mTLS 配置(生产环境必需)
# APPKS_GRPC_TLS_CA_CERT=/path/to/ca.pem
# APPKS_GRPC_TLS_CLIENT_CERT=/path/to/client.pem
# APPKS_GRPC_TLS_CLIENT_KEY=/path/to/client-key.pem
# APPKS_GRPC_TLS_DOMAIN=appks.internal
# --- OpenTelemetry 可观测性 ---
# 服务名
# OTEL_SERVICE_NAME=imks
# OTEL_SERVICE_VERSION=0.1.0
# OTLP 收集器地址
# OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
# 协议: grpc | http/protobuf
# OTEL_EXPORTER_OTLP_PROTOCOL=grpc
# 启用/禁用 telemetry
# OTEL_TRACES_ENABLED=true
# OTEL_METRICS_ENABLED=true
# OTEL_LOGS_ENABLED=true
# 日志级别: trace | debug | info | warn | error
RUST_LOG=info
# 日志格式: json | pretty
# LOG_FORMAT=json
# 部署环境标识
# OTEL_RESOURCE_ATTRIBUTES_DEPLOYMENT=development