API reference / @jsprismarine/prismarine / stats/serverMetrics
stats/serverMetrics
Interfaces
ServerMetricSources
Defined in: packages/prismarine/src/stats/serverMetrics.ts:74
What the server metrics read: the settings, the started transports, the sessions and the values the build stamped in.
Properties
build?
readonlyoptionalbuild?: () =>BuildDefines
Defined in: packages/prismarine/src/stats/serverMetrics.ts:79
The values the build stamped in, read on each reading. This build's by default.
Returns
config
readonlyconfig:Pick<Config,"getOnlineMode">
Defined in: packages/prismarine/src/stats/serverMetrics.ts:75
networking
readonlynetworking:Pick<ServerNetworking,"getStartedTransports">
Defined in: packages/prismarine/src/stats/serverMetrics.ts:76
sessions
readonlysessions:Pick<SessionManager,"getSessions">
Defined in: packages/prismarine/src/stats/serverMetrics.ts:77
Type Aliases
ServerMetricName
ServerMetricName = typeof
ServerMetric[keyof typeofServerMetric]
Defined in: packages/prismarine/src/stats/serverMetrics.ts:34
One of the server's metric names, such as jsprismarine:players.
Variables
DEVICE_OS_NAMES
constDEVICE_OS_NAMES:object
Defined in: packages/prismarine/src/stats/serverMetrics.ts:40
The name each device OS a client reports goes by, for every BuildPlatform member. DEDICATED is Bedrock Dedicated Server's own value, which no player client sends.
Type Declaration
-1
readonly-1:"Unknown"='Unknown'
1
readonly1:"Android"='Android'
11
readonly11:"PlayStation"='PlayStation'
12
readonly12:"Nintendo Switch"='Nintendo Switch'
13
readonly13:"Xbox"='Xbox'
15
readonly15:"Linux"='Linux'
2
readonly2:"iOS"='iOS'
3
readonly3:"macOS"='macOS'
4
readonly4:"Fire OS"='Fire OS'
8
readonly8:"Windows"='Windows'
9
readonly9:"Dedicated Server"='Dedicated Server'
ServerMetric
constServerMetric:object
Defined in: packages/prismarine/src/stats/serverMetrics.ts:14
The names of the metrics the server registers about itself, keyed by the part after the jsprismarine: namespace. A provider that reads one of them by name reads it from here.
Type Declaration
build_type
readonlybuild_type:"jsprismarine:build_type"='jsprismarine:build_type'
dev, nightly or release, a label.
online_mode
readonlyonline_mode:"jsprismarine:online_mode"='jsprismarine:online_mode'
online or offline, a label.
player_platform
readonlyplayer_platform:"jsprismarine:player_platform"='jsprismarine:player_platform'
Online players per device platform, such as Android, a distribution.
player_protocol
readonlyplayer_protocol:"jsprismarine:player_protocol"='jsprismarine:player_protocol'
Online players per Minecraft release, then protocol number, a breakdown.
player_transport
readonlyplayer_transport:"jsprismarine:player_transport"='jsprismarine:player_transport'
Online players per transport they joined over, a distribution.
players
readonlyplayers:"jsprismarine:players"='jsprismarine:players'
Players online, a gauge.
transports
readonlytransports:"jsprismarine:transports"='jsprismarine:transports'
The transports the server started, a set.
version
readonlyversion:"jsprismarine:version"='jsprismarine:version'
The server version, such as 0.20.0, a label.
Functions
deviceOsName()
deviceOsName(
os):string
Defined in: packages/prismarine/src/stats/serverMetrics.ts:67
The name of a device OS a client reported. The value comes from the client's login, so only a number that is a BuildPlatform member counts, and anything else is Unknown.
Parameters
os
unknown
The DeviceOS value from the client's login, or undefined for a player with no device.
Returns
string
A name from DEVICE_OS_NAMES.
serverMetrics()
serverMetrics(
sources):StatsMetric[]
Defined in: packages/prismarine/src/stats/serverMetrics.ts:97
The metrics the server registers about itself, one per ServerMetric name. Each reads its source when a provider asks, so a config reload or a player joining shows up in the next reading.
A protocol is reported under the first Minecraft release that speaks it, such as 1.26.60 for the protocol 1.26.60 to 1.26.62 share, since a client names only its protocol.
Parameters
sources
The config, the networking, the session manager and the build values to read.
Returns
The metrics, in ServerMetric order.