diff --git a/beacon_chain/beacon_node.nim b/beacon_chain/beacon_node.nim index 23efd53a1..a8489623e 100644 --- a/beacon_chain/beacon_node.nim +++ b/beacon_chain/beacon_node.nim @@ -23,18 +23,26 @@ const hasPrompt = not defined(withoutPrompt) # https://github.com/ethereum/eth2.0-metrics/blob/master/metrics.md#interop-metrics -declareGauge beacon_slot, "Latest slot of the beacon chain state" -declareGauge beacon_head_slot, "Slot of the head block of the beacon chain" -declareGauge beacon_head_root, "Root of the head block of the beacon chain" +declareGauge beacon_slot, + "Latest slot of the beacon chain state" +declareGauge beacon_head_slot, + "Slot of the head block of the beacon chain" +declareGauge beacon_head_root, + "Root of the head block of the beacon chain" # https://github.com/ethereum/eth2.0-metrics/blob/master/metrics.md#additional-metrics -declareGauge beacon_pending_exits, "Number of pending voluntary exits in local operation pool" # On slot +declareGauge beacon_pending_exits, + "Number of pending voluntary exits in local operation pool" # On slot # Metrics for tracking attestation and beacon block loss -declareCounter beacon_attestations_sent, "Number of beacon chain attestations sent by this peer" -declareCounter beacon_attestations_received, "Number of beacon chain attestations received by this peer" -declareCounter beacon_blocks_proposed, "Number of beacon chain blocks sent by this peer" -declareCounter beacon_blocks_received, "Number of beacon chain blocks received by this peer" +declareCounter beacon_attestations_sent, + "Number of beacon chain attestations sent by this peer" +declareCounter beacon_attestations_received, + "Number of beacon chain attestations received by this peer" +declareCounter beacon_blocks_proposed, + "Number of beacon chain blocks sent by this peer" +declareCounter beacon_blocks_received, + "Number of beacon chain blocks received by this peer" logScope: topics = "beacnde" diff --git a/beacon_chain/eth2_network.nim b/beacon_chain/eth2_network.nim index 0ba80290a..3efcbf49d 100644 --- a/beacon_chain/eth2_network.nim +++ b/beacon_chain/eth2_network.nim @@ -1,6 +1,6 @@ import options, tables, - chronos, json_serialization, strutils, chronicles, eth/net/nat, + chronos, json_serialization, strutils, chronicles, metrics, eth/net/nat, spec/digest, version, conf const @@ -12,6 +12,13 @@ export let globalListeningAddr = parseIpAddress("0.0.0.0") +# Metrics for tracking attestation and beacon block loss +declareCounter gossip_messages_sent, + "Number of gossip messages sent by this peer" + +declareCounter gossip_messages_received, + "Number of gossip messages received by this peer" + proc setupNat(conf: BeaconNodeConf): tuple[ip: IpAddress, tcpPort: Port, udpPort: Port] = @@ -248,6 +255,7 @@ else: result = proc(api: DaemonAPI, ticket: PubsubTicket, msg: PubSubMessage): Future[bool] {.async.} = + inc gossip_messages_received trace "Incoming gossip bytes", peer = msg.peer, len = msg.data.len, tops = msg.topics msgHandler SSZ.decode(msg.data, MsgType) @@ -259,6 +267,7 @@ else: discard await node.daemon.pubsubSubscribe(topic, makeMessageHandler(msgHandler)) proc broadcast*(node: Eth2Node, topic: string, msg: auto) = + inc gossip_messages_sent traceAsyncErrors node.daemon.pubsubPublish(topic, SSZ.encode(msg)) # TODO: