From 750f3aa598b0a0fd4eb1a546246990d38dbddd75 Mon Sep 17 00:00:00 2001 From: asepharyana Date: Thu, 24 Sep 2026 15:50:15 +0700 Subject: [PATCH] =?UTF-8?q?docs(gateway):=20correct=20metrics=20port=20?= =?UTF-8?q?=E2=80=94=204016=20was=20wrong?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The metrics server binds METRICS_PORT (code default 9090; this host runs it on 4018 — 4016 is occupied by another process). Docs said 4016 in three places, which is not what the service does. --- services/discord-gateway/ARCHITECTURE.md | 10 ++++++---- services/discord-gateway/README.md | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/services/discord-gateway/ARCHITECTURE.md b/services/discord-gateway/ARCHITECTURE.md index 5cc1552c..8043366b 100644 --- a/services/discord-gateway/ARCHITECTURE.md +++ b/services/discord-gateway/ARCHITECTURE.md @@ -43,7 +43,7 @@ services/discord-gateway/ │ ├── command-handler/ # Redis-subscribed backend→gateway commands │ ├── reaction-tracking/ thread-tracking/ user-presence/ │ ├── channel-topic/ guild-member-events/ monitor/ -│ └── gateway-metrics/ # Prometheus /metrics endpoint (port 4016) +│ └── gateway-metrics/ # Prometheus /metrics endpoint (METRICS_PORT) ``` Dependency direction is one-way: `index.ts` → `app/` → `modules/` → `shared/`. @@ -148,8 +148,8 @@ See `src/shared/redis-channels.ts` for the canonical names. `initializeDatabase()` (pg Pool, min 0). 4. `registerClientDebugLogging()` — only client debug lines carrying signal. 5. Install process guards (`registerProcessGuards`). -6. Register pipeline gauges + start the metrics server (port `METRICS_PORT`, - default 4016). +6. Register pipeline gauges + start the metrics server (`METRICS_PORT`, code + default 9090, set per deployment). 7. `client.login(token)`. On the Discord `ready` event, `lifecycle.ts` runs `startGatewayLifecycle()`: @@ -173,7 +173,9 @@ handler → close DB → destroy client → exit. ## Observability -Prometheus scrapes `127.0.0.1:4016/metrics` (`bete_*` prefix). Collectors run +Prometheus scrapes the metrics server at `127.0.0.1:$METRICS_PORT/metrics` +(`bete_*` prefix; the code default is 9090 — deployments set it explicitly, +this host uses 4018). Collectors run per-scrape and expose: process memory/uptime, and (when AI analysis is on) live pipeline gauges registered by `app/metrics-collector.ts` — `ai_analysis_queued_conversations`, `ai_analysis_active_batch_requests`, diff --git a/services/discord-gateway/README.md b/services/discord-gateway/README.md index c8608674..5cb9e983 100644 --- a/services/discord-gateway/README.md +++ b/services/discord-gateway/README.md @@ -47,7 +47,7 @@ src/ ├── attachment-upload/ # download → resize → upload ├── event-broadcaster/ # Redis pub/sub publisher ├── command-handler/ # backend → gateway commands over Redis - ├── gateway-metrics/ # Prometheus /metrics (port 4016) + ├── gateway-metrics/ # Prometheus /metrics (METRICS_PORT) ├── monitor/ # weekly digest scheduler └── reaction-tracking/ thread-tracking/ user-presence/ channel-topic/ guild-member-events/