Skip to content

Commit ed1514a

Browse files
veoxpipermerriam
authored andcommitted
plugins/ethstats: send 'uptime' to prevent "NaN%" display on dashboard. (#1474)
Currently hard-coded to "100%". Original JS `ethstats` client keeps count of failed/total data collection/submission events, so that it can showcase downtime. Additionally, original `ethstats` dashboard (server) displays nodes (clients) that have stopped sending stats, with an ever-decreasing percentage.
1 parent b4ca90b commit ed1514a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

trinity/plugins/builtin/ethstats/ethstats_service.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ async def statistics_handler(self, client: EthstatsClient) -> None:
108108
await self.sleep(5)
109109

110110
def get_node_info(self) -> EthstatsData:
111+
'''Getter for data that should be sent once, on start-up.'''
111112
return {
112113
'name': self.node_id,
113114
'contact': self.node_contact,
@@ -121,6 +122,7 @@ def get_node_info(self) -> EthstatsData:
121122
}
122123

123124
def get_node_block(self) -> EthstatsData:
125+
'''Getter for data that should be sent on every new chain tip change.'''
124126
head = self.chain.get_canonical_head()
125127

126128
return {
@@ -133,7 +135,7 @@ def get_node_block(self) -> EthstatsData:
133135
}
134136

135137
async def get_node_stats(self) -> EthstatsData:
136-
138+
'''Getter for data that should be sent periodically.'''
137139
try:
138140
peer_count = (await self.wait(
139141
self.context.event_bus.request(PeerCountRequest()),
@@ -145,6 +147,7 @@ async def get_node_stats(self) -> EthstatsData:
145147

146148
return {
147149
'active': True,
150+
'uptime': 100,
148151
'peers': peer_count,
149152
}
150153

0 commit comments

Comments
 (0)