package
5.2.0
Repository: https://github.com/prysmaticlabs/prysm.git
Documentation: pkg.go.dev

# README

Client stats reporting

Specification

The request JSON object is a non-nested object with the following properties. The process refers to which process data is associated with the request.

PropertyTypeProcessSourceDescription
versionintEvery requesthard-codedStats data specification version, current only 1 is accepted
timestamplongEvery requestsystem timeUnix timestamp in milliseconds
processstring (enum)Every requesthard-coded / cli flagEnum values: validator, beaconnode, system
cpu_process_seconds_totallongbeaconnode, validatorprom: process_cpu_seconds_totalCPU seconds consumed by the process
memory_process_byteslongbeaconnode, validatorprom: process_resident_memory_bytesNumber of bytes allocated to the process
client_namestringbeaconnode, validatorhard-coded to "prysm"Name of the client type. Ex: prysm, lighthouse, nimbus, teku
client_versionstringbeaconnode, validatorprom: prysm_version (label: version)Client version. Ex: 1.0.0-beta.0
client_buildintbeaconnode, validatorprom: prysm_version (label: buildDate)Integer representation of build for easier comparison
disk_beaconchain_bytes_totallongbeaconchainprom: bcnode_disk_beaconchain_bytes_totalThe amount of data consumed on disk by the beacon chain's database.
network_libp2p_bytes_total_receivelongbeaconchain(currently unsupported)The number of bytes received via libp2p traffic
network_libp2p_bytes_total_transmitlongbeaconchain(currently unsupported)The number of bytes transmitted via libp2p traffic
network_peers_connectedintbeaconchain(currently unsupported)The number of peers currently connected to the beacon chain
sync_eth1_connectedboolbeaconchainprom: powchain_sync_eth1_connectedWhether or not the beacon chain node is connected to a synced eth1 node
sync_eth2_syncedboolbeaconchainprom: beacon_clock_time_slot (true if this equals prom: beacon_head_slot)Whether or not the beacon chain node is in sync with the beacon chain network
sync_beacon_head_slotlongbeaconchainprom: beacon_head_slotThe head slot number.
sync_eth1_fallback_configuredboolbeaconchainprom: powchain_sync_eth1_fallback_configuredWhether or not the beacon chain node has a fallback eth1 endpoint configured.
sync_eth1_fallback_connectedboolbeaconchainprom: powchain_sync_eth1_fallback_connectedWhether or not the beacon chain node is connected to a fallback eth1 endpoint. A true value indicates a failed or interrupted connection with the primary eth1 endpoint.
slasher_activeboolbeaconchain(coming soon)Whether or not slasher functionality is enabled.
sync_eth2_fallback_configuredboolvalidator(currently unsupported)Whether or not the process has a fallback eth2 endpoint configured
sync_eth2_fallback_connectedboolvalidator(currently unsupported)Weather or not the process has connected to the failover eth2 endpoint. A true value indicates a failed or interrupted connection with the primary eth2 endpoint.
validator_totalintvalidatorprom: validator_statuses (count of all peers)The number of validating keys in use.
validator_activeintvalidatorprom: validator_statuses (count of peers w/ "ACTIVE" status label)The number of validator keys that are currently active.
cpu_coresintsystem(currently unsupported)The number of CPU cores available on the host machine
cpu_threadsintsystem(currently unsupported)The number of CPU threads available on the host machine
cpu_node_system_seconds_totallongsystem(currently unsupported)Overall CPU seconds observed on the host machine for all processes.
cpu_node_user_seconds_totallongsystem(currently unsupported)??
cpu_node_iowait_seconds_totallongsystem(currently unsupported)??
cpu_node_idle_seconds_totallongsystem(currently unsupported)??
memory_node_bytes_totallongsystem(currently unsupported)??
memory_node_bytes_freelongsystem(currently unsupported)??
memory_node_bytes_cachedlongsystem(currently unsupported)??
memory_node_bytes_bufferdlongsystem(currently unsupported)??
disk_node_bytes_totallongsystem(currently unsupported)??
disk_node_bytes_freelongsystem(currently unsupported)??
disk_node_io_secondslongsystem(currently unsupported)??
disk_node_reads_totallongsystem(currently unsupported)??
disk_node_writes_totallongsystem(currently unsupported)??
network_node_bytes_total_receivelongsystem(currently unsupported)??
network_node_bytes_total_transmitlongsystem(currently unsupported)??
misc_node_boot_ts_systemlongsystem(currently unsupported)??
misc_osstringsystem(currently unsupported)Enum values: lin, win, mac, unk

The client stats reporter will submit a request object for each process type. The report request may submit a list of data or a single JSON object.

Examples

POST https://beaconcha.in/api/v1/stats/$API_KEY/$MACHINE_NAME

Single object payload

{
   "version": 1,
   "timestamp": 11234567,
   "process": "validator",
   "cpu_process_seconds_total": 1234567,
   "memory_process_bytes": 654321,
   "client_name": "lighthouse",
   "client_version": "1.1.2",
   "client_build": 12,
   "sync_eth2_fallback_configured": false,
   "sync_eth2_fallback_connected": false,
   "validator_total": 3,
   "validator_active": 2
}

Multiple object payload

[
   {
  	"version":1,
  	"timestamp":1618835497239,
  	"process":"beaconnode",
  	"cpu_process_seconds_total":6925,
  	"memory_process_bytes":1175138304,
  	"client_name":"lighthouse",
  	"client_version":"1.1.3",
  	"client_build":42,
  	"sync_eth2_fallback_configured":false,
  	"sync_eth2_fallback_connected":false,
  	"validator_active":1,
  	"validator_total":1
   },
   {
  	"version":1,
  	"timestamp":1618835497258,
  	"process":"system",
  	"cpu_cores":4,
  	"cpu_threads":8,
  	"cpu_node_system_seconds_total":1953818,
  	"cpu_node_user_seconds_total":229215,
  	"cpu_node_iowait_seconds_total":3761,
  	"cpu_node_idle_seconds_total":1688619,
  	"memory_node_bytes_total":33237434368,
  	"memory_node_bytes_free":500150272,
  	"memory_node_bytes_cached":13904945152,
  	"memory_node_bytes_buffers":517832704,
  	"disk_node_bytes_total":250436972544,
  	"disk_node_bytes_free":124707479552,
  	"disk_node_io_seconds":0,
  	"disk_node_reads_total":3362272,
  	"disk_node_writes_total":47766864,
  	"network_node_bytes_total_receive":26546324572,
  	"network_node_bytes_total_transmit":12057786467,
  	"misc_node_boot_ts_seconds":1617707420,
  	"misc_os":"unk"
   }
]

# Functions

NewBeaconNodeScraper constructs a Scaper capable of scraping the prometheus endpoint of a beacon-node process and producing the json body for the beaconnode client-stats process type.
NewClientStatsHTTPPostUpdater is used when the update endpoint is reachable via an HTTP POST request.
NewGenericClientStatsUpdater can Update any io.Writer.
NewValidatorScraper constructs a Scaper capable of scraping the prometheus endpoint of a validator process and producing the json body for the validator client-stats process type.

# Constants

# Structs

APIMessage are common to all requests to the client-stats API Note that there is a "system" type that we do not currently support -- if we did APIMessage would be present on the system messages as well as validator and beaconnode, whereas CommonStats would only be part of beaconnode and validator.
BeaconNodeStats embeds CommonStats and represents metrics specific to the beacon-node process.
CommonStats represent generic metrics that are expected on both beaconnode and validator metric types.
ValidatorStats embeds CommonStats and represents metrics specific to the validator process.

# Interfaces

A Scraper polls the data source it has been configured with and interprets the content to produce a client-stats process metric.
An Updater can take the io.Reader created by Scraper and send it to a data sink for consumption.