Gateway control
Gateway control is the Admin view of the running main Gateway cluster. It reads live node state and submits guild reload requests, and it exposes no session, presence, or call payload.
Fluxer answers every operation on this page with one RPC call to the main Gateway. A call that goes unanswered returns 504 GATEWAY_TIMEOUT. An overloaded cluster, or one with no responder, returns 503 SERVICE_UNAVAILABLE. A reply that cannot be interpreted returns 502 BAD_GATEWAY.
Node statistics object
Section titled “Node statistics object”One snapshot of the Gateway cluster, taken across the nodes the request polled. Every top-level counter except uptime_seconds, node_count, and status is a plain sum over those nodes, including each member of memory. The nodes array reports each polled node on its own.
Structure
Section titled “Structure”| Field | Type | Description |
|---|---|---|
| status1 | string | The aggregate health of the cluster |
| sessions | integer | The connected client Gateway sessions, summed across nodes |
| guilds | integer | The live guild processes, summed across nodes |
| presences | integer | The tracked presences, summed across nodes |
| calls | integer | The live calls, summed across nodes |
| memory | node memory object | The memory accounting, summed across nodes |
| process_count | integer | The Erlang processes in use, summed across nodes |
| process_limit | integer | The Erlang process ceiling, summed across nodes |
| uptime_seconds2 | integer | The lowest uptime any polled node reported, in seconds |
| node_count3 | integer | The number of nodes the request polled |
| nodes4 | array[gateway node object] | The per-node breakdown (max 1000 entries) |
1 healthy when every polled node reported healthy and degraded when at least one did not
2 The value tracks the most recently started node and drops back whenever any node restarts
3 Includes nodes that did not answer
4 Entries are ordered by node_id ascending. The node that served the request is always polled, so the array is never empty
Example
Section titled “Example”{ "status": "healthy", "sessions": 4820, "guilds": 1913, "presences": 4611, "calls": 12, "memory": {"total": "3221225472", "processes": "1610612736", "system": "1610612736"}, "process_count": 92114, "process_limit": 2097152, "uptime_seconds": 84213, "node_count": 2, "nodes": []}Gateway node object
Section titled “Gateway node object”One entry for each node the request polled, including nodes that did not answer within the 10 second per-node deadline.
Structure
Section titled “Structure”| Field | Type | Description |
|---|---|---|
| node_id1 | string | The name the node reports for itself |
| status2 | string | The health this node reported |
| sessions | integer | The connected client Gateway sessions on this node |
| guilds | integer | The live guild processes on this node |
| presences | integer | The tracked presences on this node |
| calls | integer | The live calls on this node |
| memory | node memory object | The memory accounting for this node |
| process_count | integer | The Erlang processes in use on this node |
| process_limit | integer | The Erlang process ceiling on this node |
| uptime_seconds | integer | The seconds since this node started |
1 A node reports its HOSTNAME environment value when that value is a non-blank string, and its Erlang node name otherwise
2 healthy for a node that answered and unavailable for one that did not. A node that did not answer reports null in place of every counter here and contributes zero to every cluster total
A node entry can have further diagnostic members. A client treats a member it does not recognise as absent.
Node memory object
Section titled “Node memory object”Byte counts for one node, or for every polled node summed together. Every value is a decimal string because a JSON number cannot preserve a 64-bit byte count.
Structure
Section titled “Structure”| Field | Type | Description |
|---|---|---|
| total | string | The total bytes allocated |
| processes | string | The bytes allocated to Erlang processes |
| system | string | The bytes allocated outside Erlang processes |
Guild memory statistics object
Section titled “Guild memory statistics object”One entry for each live guild process the read sampled. Every value except nsfw_level is read from the guild process itself.
Structure
Section titled “Structure”| Field | Type | Description |
|---|---|---|
| node_id | string | The node that owns the guild process |
| guild_id | ?snowflake | The ID of the guild the process serves, or null when the process state has no guild ID |
| guild_name1 | string | The guild name the process holds in memory |
| guild_icon | ?string | The icon hash the guild process holds in memory, or null when it has none |
| nsfw_level2 | ?integer | The NSFW level resolved from stored guild data, or null when the guild could not be resolved |
| memory3 | string | The bytes the guild process occupies, as a decimal string |
| member_count | integer | The number of members the guild process holds |
| session_count | integer | The number of sessions subscribed to the guild process |
| presence_count | integer | The number of presences the guild process tracks |
1 A process whose cached guild data has no name reports Unknown
2 Null for a live process whose guild row could not be loaded and for a process that reports no guild_id
3 The Erlang process memory of the guild process. Entries are ordered by it descending across the whole cluster, with ties broken by guild_id ascending
Voice state count object
Section titled “Voice state count object”Cluster voice state totals, with one grouping by voice region and one by voice server.
Structure
Section titled “Structure”| Field | Type | Description |
|---|---|---|
| total_voice_states1 | integer | The voice states across the whole cluster |
| regions2 | array[region voice state count object] | The counts grouped by voice region (max 1000 entries) |
| servers2 | array[server voice state count object] | The counts grouped by voice server (max 5000 entries) |
1 The sum of the totals each node reported, so it can differ from the sum of the entries in regions or servers
2 Entries are ordered by voice_state_count descending, with ties broken by identifier ascending. An identifier with no voice states is absent from the array, so every entry has a count of at least 1
Example
Section titled “Example”{ "total_voice_states": 318, "regions": [{"region_id": "europe-north", "voice_state_count": 204}], "servers": [{"server_id": "europe-north-server-1", "voice_state_count": 204}]}Region voice state count object
Section titled “Region voice state count object”One entry for each voice region that holds at least one voice state.
Structure
Section titled “Structure”| Field | Type | Description |
|---|---|---|
| region_id | string | The ID of the region the count belongs to |
| voice_state_count | integer | The voice states attributed to the region |
Server voice state count object
Section titled “Server voice state count object”One entry for each voice server that holds at least one voice state.
Structure
Section titled “Structure”| Field | Type | Description |
|---|---|---|
| server_id1 | string | The ID of the server the count belongs to |
| voice_state_count | integer | The voice states attributed to the server |
1 The identifier is unique only inside its region
Get Gateway node statistics
Section titled “Get Gateway node statistics”GET/v1/admin/gateway/statsReturns the node statistics object for the whole Gateway cluster. Requires gateway:memory_stats.
Response
Section titled “Response”| Status | Body | Condition |
|---|---|---|
| 200 | node statistics object | Cluster state was returned |
Rate limit
Section titled “Rate limit”200 requests per minute for each authenticated user, on the admin:lookup bucket.
Get guild memory statistics
Section titled “Get guild memory statistics”GET/v1/admin/gateway/memory-statsReturns the heaviest live guild processes as guild memory statistics objects. Requires gateway:memory_stats.
Query parameters
Section titled “Query parameters”| Field | Type | Description |
|---|---|---|
| limit?1 | integer | The maximum guild processes to return (100-1000, default 100) |
1 The Gateway clamps the value it acts on to 500, and each node contributes at most 100 of its own guild processes. A limit of 1000 returns at most 500 entries
Response body
Section titled “Response body”| Field | Type | Description |
|---|---|---|
| guilds | array[guild memory statistics object] | The guild processes in this response (max 1000 entries) |
Response
Section titled “Response”| Status | Body | Condition |
|---|---|---|
| 200 | response body | The guild processes were returned |
Side effects
Section titled “Side effects”A node that does not answer within 5 seconds contributes no entries, and the request still returns 200.
Rate limit
Section titled “Rate limit”200 requests per minute for each authenticated user, on the admin:lookup bucket.
Get voice state counts
Section titled “Get voice state counts”GET/v1/admin/gateway/voice-state-countsReturns the voice state count object, grouped by voice region and by voice server. Requires gateway:memory_stats.
Response
Section titled “Response”| Status | Body | Condition |
|---|---|---|
| 200 | voice state count object | Counts were returned |
Side effects
Section titled “Side effects”The counts cover voice states in guild channels and in calls. A node that does not answer within 10 seconds contributes zero, and the request still returns 200.
Rate limit
Section titled “Rate limit”200 requests per minute for each authenticated user, on the admin:lookup bucket.
Reload Gateway guilds
Section titled “Reload Gateway guilds”POST/v1/admin/gateway/reloadsRebuilds server-side state for the supplied guilds from the database and returns how many live guild processes were selected. Requires gateway:reload_all.
JSON body
Section titled “JSON body”| Field | Type | Description |
|---|---|---|
| guild_ids1 | array[snowflake] | The guilds to reload (max 1000 entries) |
1 The field is required. An empty array selects every live guild process on every active node
Response body
Section titled “Response body”| Field | Type | Description |
|---|---|---|
| count1 2 | integer | The number of live guild processes selected for reload |
1 A supplied guild with no live process is skipped, so the value can be lower than the number of IDs sent. An owner node that fails or does not answer within 15 seconds contributes zero
2 Taken when the processes are selected. A selected process whose guild data cannot be fetched is still counted, so the value is an upper bound on the reloads that succeeded
Response
Section titled “Response”| Status | Body | Condition |
|---|---|---|
| 200 | response body | Every selected guild process was dispatched |
Side effects
Section titled “Side effects”Each node reloads its selection in batches of ten with a 100 millisecond delay between batches. A guild whose owner node cannot be resolved is not counted. The response returns once the last batch has been dispatched, so an individual reload can still be in progress when the caller receives it. No guild data is changed and no Admin audit entry is recorded.
Rate limit
Section titled “Rate limit”5 requests per minute for each authenticated user, on the admin:gateway:reload bucket.