21 symbols from @neontechspace/fluxerly
Interfaces#
ClientCounters #
Running totals for one client since creation, returned by diagnostics().counters
Values only increase
interface ClientCounterscache#Changes Dropped -
Cache changes not delivered to a
cachelistener because its waiting changes reached.on Change maxPending Changes number cleanup#Failures -
Shutdown or subscription cleanup steps that failed
number command#Rejections -
Prefix commands rejected by a guard, cooldown or argument parser
number events#Dropped -
Events not delivered to a subscription, by reason
The reason overflow is a full queue, malformed is a rejected dispatch, collector is a full collector buffer and closed is a shutdown or closed subscription
closed-
Events still waiting when a subscription or the client closed, plus events a draining shutdown refused after it stopped accepting new ones
number collector-
Messages or reactions dropped because a collector buffer was full
number malformed-
Gateway dispatches skipped because they failed validation
number overflow-
Events dropped because a subscription queue was full
number
events#Dropped By Event -
Events not delivered, by event name, counted at the same places as
eventsDropped A name appears after its first drop. Drops that have no known event name are counted only in the
eventsreasons, so the sum here can be lower than the sum there. That covers a malformed dispatch whose type several events share, such as CHANNEL_CREATE, which delivers bothDropped guildandChannel Create directMessage Create Readonly<Partial<Record<EventName, number>>>Readonly< Partial<Record<EventName, number>> > handler#Failures -
number protocol#Failures -
Gateway messages rejected as invalid protocol data, including skipped malformed dispatches
number rate#Limit Waits -
REST rate-limit waits that took place
A limit whose wait would pass the request deadline fails the request without waiting, logs
ratelimitand is not counted here.deadline number reconnects#-
Gateway reconnection attempts after an established connection was lost
number reports#Dropped -
Failure reports that could not be queued for a busy hook and were logged instead
number rest#Busy -
REST requests that failed with reason busy before sending, because the REST queue or the upload byte budget was full
The first such failure in a minute also logs
restat Warn.busy number sink#Failures -
Log output failures: Sink and observe calls that threw or rejected, console or Effect logger output that failed, and failure reports that could not be formatted
The first one is described on standard error
number unknown#Dispatches -
Dispatch types the SDK does not handle
number unknown#Opcodes -
Gateway opcodes the SDK does not handle
number unmatched#Commands -
Messages with the command prefix that matched no command
number
ClientDiagnostics #
Inspect this client's current connection state, occupied request slots and cache usage
These local values do not describe other processes or guarantee that a later request can start or the gateway will stay ready. Diagnostics include no token, remote route, resource ID or cached payload
interface ClientDiagnosticscaches#-
Accounting for each local cache category
Closure releases retained snapshots but leaves configured capacity values available for inspection
Readonly<Record<CacheKind, CacheDiagnostic>>Readonly< Record<CacheKind, CacheDiagnostic> > counters#-
Running totals of failures, drops, retries, waits and reconnects since creation, including work the logs summarized or suppressed
ClientCounters events#-
Current event sources, collectors and running callbacks owned by this client, not process memory or a shared quota
Counts exclude other clients and application tasks outside SDK event handlers
activeHandlers -
Subscription callbacks currently executing, excluding idle subscriptions and collector filters
number messageCollectors -
Registered message collectors, including collectors waiting for matching messages
number reactionCollectors -
Registered reaction collectors, including collectors waiting for matching reactions
number subscriptions-
Open event sources, including subscriptions, event streams and single-event waits
number
gateway#Latency Ms -
Slowest current shard heartbeat round-trip time in milliseconds, or null under
Clientavailability rulesState .gateway Latency Ms number | null gateway#Requests -
Local request slots shared by fresh counts and member streams, not provider worker occupancy or a cross-process quota
activeCapacity -
Maximum logical requests allowed concurrently by this client
number activeRequests -
Logical count requests and member streams currently holding shared local slots
number
rest#-
HTTP requests running or waiting for a slot in this client
Active values combine the
restREST or upload slots, four per local shard by default, with the separate.concurrency restmedia-download slots, four by default. Queued JSON bytes exclude attachment transfers and do not measure heap or process memory.media Concurrency activeCapacity -
Combined active-request capacity of those two pools
number activeRequests -
Requests currently using either the REST/upload pool or the media-download pool
number queuedCapacity -
Maximum queued requests shared by both pools
number queuedJson Byte Capacity -
Maximum accounted JSON-body bytes allowed in the shared queue
number queuedJson Bytes -
Accounted JSON-body bytes of queued requests, excluding attachment transfer bytes
number queuedRequests -
Requests waiting for a local request slot
number
shards#-
Current locally owned shard state only, in configured local order
Empty for an automatically sized client until its first connect has chosen the plan
readonly ShardState[] state#-
Current aggregate client lifecycle state, not an event history or a readiness promise
ConnectionState uploads#-
Attachment transfer reservations across queued and active uploads, not caller buffers or remote temporary storage
byteCapacity -
Configured maximum transfer-byte reservation for this client
number reservedBytes -
Attachment transfer bytes currently reserved by queued and active work
number
ClientLogging #
Change what this client logs while it runs
Creation settings other than level, categories and debug, such as sink and format, stay fixed for the client's lifetime
interface ClientLoggingconfigure#
Replace the client's log level and per-category levels, and optionally its Debug categories, effective for the next record
The settings are validated like level, categories and debug in the logging option of create. Omitted level and categories return to their defaults, level info without category levels, as at creation. An omitted debug keeps the current Debug categories, which start as the debug creation setting plus FLUXERLY_DEBUG. A debug value replaces them, including those from FLUXERLY_DEBUG. Pass true for every category, a list for only those categories, or false or an empty list for none. Debug categories lower their threshold to Debug, never raise it. It works before, during and after a connection, and changes nothing else about the client
configure(settings: LogLevelSettings): voidconfigure(
settings: LogLevelSettings
): voidParameters
settings-
LogLevelSettings
Returns synchronously. Invalid settings, including keys other than level, categories and debug, throw
Configuration and leave the previous settings in place. A throwing settings getter throws Sdk with code
application
export function traceRequests(client) {
client.logging.configure({ categories: { rest: "debug" } })
}
export function stopDebugOutput(client) {
client.logging.configure({ debug: false })
}
import type { Client } from "@neontechspace/fluxerly"
export function traceRequests(client: Client) {
client.logging.configure({ categories: { rest: "debug" } })
}
export function stopDebugOutput(client: Client) {
client.logging.configure({ debug: false })
}
ErrorInfo #
Readable facts about an error attached to a log record or failure report
Application errors keep their name, string code, message, stack and cause chain with credentials masked. SDK errors add their fixed code and hint
interface ErrorInfocodeoptional#-
Fixed SDK error code, or a string code property of an application error with credentials masked
string detailsoptional#-
Safe structured facts from an SDK error
Readonly<Record<string, unknown>> hintoptional#-
Suggested next step from an SDK error
string message#-
Error message, or a text form of a thrown non-Error value
string name#-
Error name, such as TypeError or
Guild, or Non-Error value (string) for a thrown value that is not an ErrorOperation Error string origin#-
Where the failure came from
The value application marks values thrown by application callbacks, provider marks Fluxer rejections and sdk marks SDK failures
"sdk" | "application" | "provider" stackoptional#-
Stack trace, when the value had one
string
FailureMessageReference #
IDs of the message involved in a failure, without its content
interface FailureMessageReferenceFailureReport #
A failure outside any returned result, delivered to an on hook or logged at Error with its full error
Reports delivered to a hook log at Debug without repeating the error. A handler failure caused by an HTTP 401 or 403 rejection replaces that rejection's Warn only when reported within one second, otherwise both records appear. The error is the real value that the application callback threw or rejected with, or the SDK error that stopped the work. The message reference contains IDs only. The original error can contain message content or other application data
interface FailureReportcommandoptional#-
Prefix command name, when a command callback failed
string error#-
The original thrown, rejected or failed value
unknown eventoptional#-
Event whose delivery failed, when the failure belongs to an event subscription
keyof EventMap<Message> kind#-
What failed
FailureKind messageoptional#-
IDs of the message being handled, when there was one
FailureMessageReference subscriptionoptional#Id -
Identifier of the subscription that owns the failed work, matching
Subscriptionand log records.id string
describe#
Readable multi-line summary with the error's name, application code, message, stack and cause chain
Credential patterns and the client's configured credentials are masked, without changing the original error
describe(): string- Returns
string
HandlerObservation #
One finished event handler or prefix command router invocation, including event and command middleware
A router emits one observation for every handled message, even when it matches no command
interface HandlerObservationcommandoptional#-
Canonical prefix command name when the router matched one, including denied or middleware-stopped commands
Absent when no command matched
string duration#Ms -
Milliseconds from the start of the invocation until it finished
number erroroptional#Code -
Stable code of the failure's error, when it has one
string erroroptional#Name -
Name of the failure's error, such as TypeError, for a failed invocation
string outcome#-
How the invocation ended
The value success means it finished without a reported failure, including a command denial or no command match. The value failure means a handler, command or middleware failure was reported to
onor the log, even when middleware recovered from it. The value cancelled means interruption stopped the invocation, such as shutdown or closing the subscription, and takes precedence over an earlier reported failureError "success" | "failure" | "cancelled" subscription#Id -
Identifier of the subscription that ran the handler, such as
message#3Create string
LogRecord #
One structured SDK log record, delivered frozen to sinks and printed by the built-in console output
Records never contain tokens, Authorization headers, client secrets, invite codes or the user information of a URL, such as user:password in https://
interface LogRecordattemptoptional#-
One-based attempt number for retried work
number category#-
SDK area that produced the record
LogCategory closeoptional#Code -
WebSocket close code
number code#-
Stable dotted identifier, such as
lifecycle,.ready ratelimitor.wait events.dropped Match on this rather than message
string commandoptional#-
Prefix command name that the record concerns
string delayoptional#Ms -
Milliseconds until the next attempt or the end of a wait
number durationoptional#Ms -
Elapsed milliseconds for the described work
number eventoptional#-
Event name that the record concerns, such as
messageCreate string fieldsoptional#-
Other safe facts, such as counts, opcodes and dispatch types
Readonly<Record<string, string | number | boolean | null>>Readonly< Record< string, string | number | boolean | null > > message#-
Readable sentence describing what happened, which can change between releases
string routeoptional#-
REST route template with IDs replaced by placeholders, such as /channels/:id/messages
string statusoptional#-
HTTP status
number subscriptionoptional#Id -
Identifier of the event subscription or cache observer that the record concerns
string time#-
ISO 8601 wall-clock time when the SDK created the record
string
LoggingOptions #
Configure what the SDK logs and where the output goes
Both entry points accept the same settings. With no settings, the SDK prints Info and higher records, including startup, readiness, connection loss, rate-limit waits of at least one second, shutdown and full application errors. The FLUXERLY_DEBUG environment variable, read when the client is created, enables Debug records: 1, true or * for every category, or a comma-separated list such as gateway,rest. A debug value passed to client replaces those categories while the client runs. HTTP 401 and 403 rejections log a rest Warn even when handled. An unhandled handler failure with that same rejection, directly or in its cause chain, replaces its Warn if it happens within one second. A later handler failure also logs its own record, because the Warn has already been emitted. Logging never changes operation results, and records never contain credentials
interface LoggingOptionscategoriesoptional#-
Per-category minimum severity that replaces level for that category, such as { rest: "debug", cache: "warn" }
Readonly<Partial<Record<LogCategory, LogThreshold>>>Readonly< Partial< Record<LogCategory, LogThreshold> > > debugoptional#-
Enable Debug records for every category with true, or for the listed categories
At creation it adds to FLUXERLY_DEBUG. In
clientit replaces the current Debug categories, including those from FLUXERLY_DEBUG, and false or an empty list turns them all off. It lowers, never raises, the configured threshold.logging .configure boolean | readonly LogCategory[] dedupeoptional#-
Collapse repeated identical Warn, Error and Fatal records within a window
Records about different shards or subscriptions are not identical, so each one's first occurrence is shown. The next identical record after the window reports how many were suppressed in
fieldsand as "(repeated N× since last shown)" in its message, and shutdown reports any remainder the same way. When more than 512 distinct records are tracked, the oldest one's window ends early and its count is reported then. Default {.repeated window: 60000 }. A false value or aMs windowof 0 disables collapsingMs false | { readonly windowMs?: number } formatoptional#-
Built-in console output format
The value pretty prints readable single lines with indented stacks, and json prints one
Logper line. Info and lower records go to standard output and Warn and higher to standard error, and each stream decides its own default. The default is pretty when that stream is a terminal and json otherwise. Without this setting, the FLUXERLY_LOG_FORMAT environment variable, pretty or json, read when the client is created, chooses the format for both streams, and FLUXERLY_LOG_COLOR forces color on with 1, true, yes or on, and off with 0, false, no or off, for pretty output. Another nonempty value of either variable is ignored with oneRecord sdkWarn at startup. NO_COLOR still disables color. A supervisor makes its default-API children log JSON and prints their records in the format of its own streams. Native clients without sink or format send records to the Effect logger instead, and the environment variables do not change that.unknown Environment Value "json" | "pretty" leveloptional#-
Minimum severity to emit, default info
The value silent emits nothing, including application error reports without a hook and unsafe payload records
LogThreshold sinkoptional#-
Receive records instead of the built-in console output
Pass one function or an array of them. Each sink is called synchronously in order for every emitted record
LogSink | readonly LogSink[] unsafeoptional#-
Print received and sent payload bodies at Trace level for debugging, for all categories or the listed ones
Payload records bypass the level setting, except that a category set to silent prints no payloads. Payloads can contain private message content, so the SDK prints a Warn banner once, at startup or before the first payload record, whichever comes first, even when the level would hide Warn records. Received REST bodies show at most their first 65,536 bytes. Tokens, Authorization headers, client secrets, passwords, cookies, invite codes and the user information of a URL stay masked even in this mode, including credential-key values in a truncated JSON response
categoriesoptional-
Print payloads only for these categories, such as gateway or rest
Omit for every category
readonly LogCategory[] payloads-
Must be true to acknowledge that payload bodies can contain private content
true
RateLimitObservation #
A REST request that waits before retrying because Fluxer rate-limited it with HTTP 429
The optional members repeat the rate-limit headers and body members of that response, so the limiter that answered can be identified. Each is absent when the response did not send it or sent it in another form. The scope and bucket headers must be at most 64 letters, digits, underscores, periods, colons or hyphens, a count header at most 15 digits, and a seconds header at most 32 characters of digits with one optional decimal point. The body members must be a finite non-negative number for retry_after and a boolean for global. Credentials in scope and bucket are masked as in log records
interface RateLimitObservationbodyoptional#Global -
The body's global member, unlike global, which combines it with the headers
boolean bucketoptional#-
The X-RateLimit-Bucket header, an opaque identifier of the route's rate-limit bucket
string global#-
Whether the limit pauses every API route of this client rather than one rate-limit group
It is true when the body's global member is true, the X-RateLimit-Global header is true or the X-RateLimit-Scope header is global
boolean limitoptional#-
The X-RateLimit-Limit header, the number of requests the route allowance admits at once
number method#-
HTTP method of the waiting request
string remainingoptional#-
The X-RateLimit-Remaining header, the number of requests the route allowance still admits
number resetoptional#After Seconds -
The X-RateLimit-Reset-After header, seconds until the whole route allowance is available again
number retryoptional#After Header Seconds -
The Retry-After header in seconds
An HTTP date in this header is not reported
number retryoptional#After Seconds -
The body's retry_after member, seconds until Fluxer admits another request
number scopeoptional#-
The X-RateLimit-Scope header, such as user, shared or global
string type#-
Discriminator for a rate-limit wait
"rateLimit" wait#Ms -
Milliseconds the request waits before its retry
number
ReconnectObservation #
A shard begins a reconnection attempt after its established connection was lost
interface ReconnectObservationtype#-
Discriminator for a reconnection attempt
"reconnect"
RestObservation #
One finished REST request attempt
A retried request reports each attempt separately
interface RestObservationattempt#-
One-based attempt number
Values above 1 are automatic retries of the same request
number duration#Ms -
Milliseconds from sending the request until its response headers arrived or it failed
number method#-
HTTP method, such as GET or POST
string status#-
HTTP status of the response, or null when no response arrived, such as after a network failure or timeout
number | null
ResumeObservation #
interface ResumeObservationType Aliases#
FailureKind #
What failed
The kind handler is an event or command callback, and overflow is a subscription stopped by a full queue. The kind collector is a message or reaction collector callback, and filter is a collector filter. The kind progress is a message cleanup on callback, cache is a cache max duration callback or a cache listener, observer is a state observer and task is one run of a client task. A failing on hook is never reported to a hook again: It is logged with the original failure and counted in diagnostics().counters.hookFailures
type FailureKind =
| "handler" | "overflow" | "collector" | "filter" | "progress"
| "cache" | "observer" | "task"type FailureKind =
| "handler" | "overflow"
| "collector" | "filter"
| "progress" | "cache"
| "observer" | "task"LogCategory #
The SDK area that produced a log record
Use it with categories and debug to adjust output for one area. The lifecycle category covers startup, readiness, connection loss and shutdown, gateway covers protocol traffic, rest covers HTTP requests and retries, ratelimit covers rate-limit waits, and cache covers cache policy and expiry. The events category covers subscriptions, handlers and dropped events, commands covers prefix commands, collectors covers message and reaction collectors, supervisor covers child processes, and sdk covers the logger itself
type LogCategory =
| "lifecycle" | "gateway" | "rest" | "ratelimit" | "cache"
| "events" | "commands" | "collectors" | "supervisor" | "sdk"type LogCategory =
| "lifecycle" | "gateway"
| "rest" | "ratelimit"
| "cache" | "events"
| "commands" | "collectors"
| "supervisor" | "sdk"LogLevel #
Severity of an SDK log record, from most to least verbose
type LogLevel =
"trace" | "debug" | "info" | "warn" | "error" | "fatal"type LogLevel =
| "trace" | "debug" | "info"
| "warn" | "error" | "fatal"LogLevelSettings #
The level, categories and debug settings of Logging, which client changes while a client runs
type LogLevelSettings =
Pick<LoggingOptions, "level" | "categories" | "debug">type LogLevelSettings =
Pick<
LoggingOptions,
| "level" | "categories"
| "debug"
>LogSink #
A synchronous callback that receives each emitted SDK record
Return values are ignored and promises are not awaited. A thrown error or rejected promise is counted in diagnostics().counters.sinkFailures and reported once on standard error, without stopping SDK work or other sinks
type LogSink = (record: LogRecord) => voidtype LogSink =
(record: LogRecord) => voidLogThreshold #
A minimum severity for SDK log output, or silent to emit nothing
type LogThreshold = LogLevel | "silent"type LogThreshold =
LogLevel | "silent"Observation#
One structured measurement passed to the observe client option
Use the type field to tell them apart
type Observation =
| RestObservation | RateLimitObservation | ReconnectObservation
| ResumeObservation | HandlerObservationtype Observation =
| RestObservation
| RateLimitObservation
| ReconnectObservation
| ResumeObservation
| HandlerObservationObserver#
Receive structured measurements of this client's work, such as REST request durations, rate-limit waits, reconnection attempts, resumed sessions and handler durations, to export as metrics or traces to any monitoring system
Each observation is a frozen object with plain values. Route templates replace IDs with placeholders, and observations never contain tokens, payloads or message content. The SDK calls the observer synchronously when the measured work finishes, so keep it short and move slow work, such as network export, elsewhere. Return values are ignored and promises are not awaited. A thrown error or rejected promise is counted in diagnostics().counters.sinkFailures and reported once on standard error, without changing SDK work
type Observer = (observation: Observation) => voidtype Observer =
(observation: Observation)
=> void