API reference / @jsprismarine/prismarine / stats/StatsProvider
stats/StatsProvider
Interfaces
StatsProvider
Defined in: packages/prismarine/src/stats/StatsProvider.ts:26
Reads the server's metrics and sends them somewhere, as a transport carries sessions. Each provider owns its schedule: one service dictates an interval, and a scrape endpoint has none.
Properties
id
readonlyid:string
Defined in: packages/prismarine/src/stats/StatsProvider.ts:28
A short name for logs, such as bstats.
Methods
start()
start(
context):void|Promise<void>
Defined in: packages/prismarine/src/stats/StatsProvider.ts:30
Starts reporting. Runs on every kernel start.
Parameters
context
Returns
void | Promise<void>
stop()
stop():
void|Promise<void>
Defined in: packages/prismarine/src/stats/StatsProvider.ts:36
Stops reporting and leaves no timer or request pending. Runs on every kernel stop. A stop that arrives while start is still pending calls it at once and again when that start returns, so it must not assume the start finished, and a second call must be harmless.
Returns
void | Promise<void>
StatsProviderContext
Defined in: packages/prismarine/src/stats/StatsProvider.ts:13
What the stats module hands a provider when it starts. The timer is injected, so a test drives a provider's schedule on a clock it moves by hand.
Properties
logger
readonlylogger:KernelLogger
Defined in: packages/prismarine/src/stats/StatsProvider.ts:17
A logger scoped to the provider's id.
registry
readonlyregistry:StatsRegistry
Defined in: packages/prismarine/src/stats/StatsProvider.ts:15
The server's metrics, read with StatsRegistry.snapshot or StatsRegistry.read.
setTimer
readonlysetTimer:CancelableTimer
Defined in: packages/prismarine/src/stats/StatsProvider.ts:19
Schedules a callback; an unreferenced setTimeout on a running server.
Type Aliases
StatsTimer
StatsTimer =
CancelableTimer
Defined in: packages/prismarine/src/stats/StatsProvider.ts:7
Runs a callback once after a delay, and returns a function that cancels it.