Skip to content
Fluxer API

Gateway control

Gateway control shows live state from the running main Gateway cluster and reloads guilds. When the API gets no answer from the Gateway in time, it returns 504 GATEWAY_TIMEOUT. It returns 503 SERVICE_UNAVAILABLE when the cluster is overloaded or unreachable and 502 BAD_GATEWAY when the answer is invalid.

A snapshot of the whole cluster. Each count and each memory value is a sum over the polled nodes, and nodes has the same values for each node.

FieldTypeDescription
status1stringThe aggregate health of the cluster
sessionsintegerThe number of connected Gateway sessions
session_resumes_totalintegerThe total number of session resumes
websocket_dispatches_totalintegerThe total number of WebSocket dispatches
websocket_dispatch_drops_totalintegerThe total number of WebSocket dispatches dropped
guildsintegerThe number of live guild processes
presencesintegerThe number of tracked presences
callsintegerThe number of live calls
memorynode memory objectThe memory accounting
process_countintegerThe number of Erlang processes running
process_limitintegerThe maximum number of Erlang processes
uptime_secondsintegerThe lowest uptime any polled node reported, in seconds
node_countintegerThe number of nodes polled, including nodes that did not answer
nodesarray[gateway node object]The per-node breakdown (max 1000 entries)

1 healthy when every polled node reported healthy, otherwise degraded.

{
"status": "healthy",
"sessions": 4820,
"session_resumes_total": 1234,
"websocket_dispatches_total": 1234567,
"websocket_dispatch_drops_total": 123,
"guilds": 1913,
"presences": 4611,
"calls": 12,
"memory": {"total": "3221225472", "processes": "1610612736", "system": "1610612736"},
"process_count": 92114,
"process_limit": 2097152,
"uptime_seconds": 84213,
"node_count": 1,
"nodes": [
{
"node_id": "fluxer-gateway-0",
"status": "healthy",
"sessions": 4820,
"session_resumes_total": 1234,
"websocket_dispatches_total": 1234567,
"websocket_dispatch_drops_total": 123,
"guilds": 1913,
"presences": 4611,
"calls": 12,
"memory": {"total": "3221225472", "processes": "1610612736", "system": "1610612736"},
"process_count": 92114,
"process_limit": 2097152,
"uptime_seconds": 84213,
"cluster_metrics": {
"gateway_cluster_member_count": 1,
"gateway_cluster_discovery_resolve_failures_total": 0,
"gateway_cluster_membership_transitions_total": {"up": 1, "down": 0},
"gateway_node_router_owner_resolutions_total": {"self": 5120, "peer": 0}
}
}
]
}

One node's statistics. A node that does not answer within 10 seconds is listed with status unavailable.

FieldTypeDescription
node_idstringThe name the node reports for itself
status1stringThe health this node reported
sessions?integerThe number of connected Gateway sessions
session_resumes_total?integerThe total number of session resumes
websocket_dispatches_total?integerThe total number of WebSocket dispatches
websocket_dispatch_drops_total?integerThe total number of WebSocket dispatches dropped
guilds?integerThe number of live guild processes
presences?integerThe number of tracked presences
calls?integerThe number of live calls
memorynode memory objectThe memory accounting
process_count?integerThe number of Erlang processes running
process_limit?integerThe maximum number of Erlang processes
uptime_seconds?integerThe seconds since this node started
cluster_metrics?gateway cluster metrics objectHow this node sees the cluster, absent when the node did not answer

1 healthy or unavailable. An unavailable node has no cluster_metrics, and its counts and memory values are null.

The cluster as one node sees it. Each _total count starts at zero when the node starts.

FieldTypeDescription
gateway_cluster_member_countintegerThe number of cluster members this node sees as up
gateway_cluster_discovery_resolve_failures_totalintegerThe number of times this node failed to resolve its peers
gateway_cluster_membership_transitions_totalmembership transition counts objectThe number of times this node saw a member join or leave
gateway_node_router_owner_resolutions_totalowner resolution counts objectThe number of owner lookups this node resolved to itself and to other nodes
FieldTypeDescription
upintegerThe number of times a member joined the cluster
downintegerThe number of times a member left the cluster
FieldTypeDescription
selfintegerThe number of owner lookups that resolved to this node
peerintegerThe number of owner lookups that resolved to another node

Byte counts for one node, or summed over all polled nodes. Each count is a decimal string, or null for a node that did not answer.

FieldTypeDescription
total?stringThe total bytes allocated
processes?stringThe bytes allocated to Erlang processes
system?stringThe bytes allocated outside Erlang processes

Memory and activity for one live guild.

FieldTypeDescription
node_idstringThe node that owns the guild process
guild_id?snowflakeThe ID of the guild
guild_namestringThe guild name in memory, or Unknown
guild_icon?stringThe icon hash in memory
nsfw_level?integerThe NSFW level, or null when the guild could not be loaded
memorystringThe bytes the guild process uses, as a decimal string
member_countintegerThe number of members the guild process holds
session_countintegerThe number of sessions subscribed to the guild process
presence_countintegerThe number of presences the guild process tracks

Cluster voice state totals, grouped by voice region and by voice server.

FieldTypeDescription
total_voice_states1integerThe number of voice states across the whole cluster
regionsarray[region voice state count object]The counts by voice region (max 1000 entries)
serversarray[server voice state count object]The counts by voice server (max 5000 entries)

1 Includes voice states with no region or server, which regions and servers leave out.

{
"total_voice_states": 318,
"regions": [{"region_id": "europe-north", "voice_state_count": 204}],
"servers": [{"server_id": "europe-north-server-1", "voice_state_count": 204}]
}
FieldTypeDescription
region_idstringThe ID of the region
voice_state_countintegerThe number of voice states in the region
FieldTypeDescription
server_idstringThe ID of the server, unique only inside its region
voice_state_countintegerThe number of voice states on the server
GET/v1/admin/gateway/statsAudit reason

Returns the node statistics object. Needs gateway:memory_stats.

StatusBodyCondition
200node statistics objectCluster state was returned

The rate limit is 200 requests per minute, on the admin:lookup bucket.

GET/v1/admin/gateway/memory-statsAudit reason

Returns the live guild processes that use the most memory, largest first. Needs gateway:memory_stats. A node that does not answer within 5 seconds adds no entries.

FieldTypeDescription
limit?1integerThe maximum number of guild processes to return (100-1000, default 100)

1 The Gateway returns at most 500 entries, and at most 100 from each node.

FieldTypeDescription
guildsarray[guild memory statistics object]The guild processes in this response (max 1000 entries)
StatusBodyCondition
200response bodyThe guild processes were returned

The rate limit is 200 requests per minute, on the admin:lookup bucket.

GET/v1/admin/gateway/voice-state-countsAudit reason

Returns the voice state count object for every voice state in guild channels and calls. Needs gateway:memory_stats. A node that does not answer within 10 seconds counts as zero.

StatusBodyCondition
200voice state count objectCounts were returned

The rate limit is 200 requests per minute, on the admin:lookup bucket.

POST/v1/admin/gateway/reloadsAudit reason

Reloads each given guild's live process from the database. Needs gateway:reload_all. Each reloaded guild sends Guild Update to its subscribed sessions.

FieldTypeDescription
guild_idsarray[snowflake]The guilds to reload (max 1000 entries)
FieldTypeDescription
count1integerThe number of live guild processes selected for reload

1 Guilds with no live process are skipped and not counted. An owner node that fails or does not answer within 15 seconds adds 0, even though its reloads can still be running.

StatusBodyCondition
200response bodyThe reloads started

The rate limit is 5 requests per minute, on the admin:gateway:reload bucket.