Skip to content

web: Make number of active nodes more clear #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions get_webstat_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ async def main():
output['containers']['mainnet'] = family.samples[0].value
if family.name == 'neo_exporter_netmap':
for sample in family.samples:
node_mainnet_count += sample.value
sample.labels['nodes']=[{'net': 'main', 'value': sample.value }]
node_mainnet_count += int(sample.value)
sample.labels['nodes']=[{'net': 'main', 'value': int(sample.value) }]
map_node.append( sample.labels )

output['node_map'] = map_node
Expand All @@ -162,10 +162,10 @@ async def main():

if node_mainnet_count <= 3:
output['status']['mainnet'] = "Severe"
output['statusmsgs']['mainnet'].append(f"{node_mainnet_count} / 5 nodes is available")
output['statusmsgs']['mainnet'].append(f"{node_mainnet_count} out of 5 nodes {'is' if node_mainnet_count == 1 else 'are'} available")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i do not want believe that we ever see "0" but if yes, i think it is also "is"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elif node_mainnet_count <= 4:
output['status']['mainnet'] = "Degraded"
output['statusmsgs']['mainnet'].append(f"{node_mainnet_count} / 5 nodes is available")
output['statusmsgs']['mainnet'].append(f"{node_mainnet_count} out of 5 nodes {'is' if node_mainnet_count == 1 else 'are'} available")
except:
# Connection error
output['status']['mainnet'] = "Unknown"
Expand All @@ -181,8 +181,8 @@ async def main():
output['containers']['testnet'] = family.samples[0].value
if family.name == 'neo_exporter_netmap':
for sample in family.samples:
node_testnet_count += sample.value
sample.labels['nodes']=[{'net': 'test', 'value': sample.value }]
node_testnet_count += int(sample.value)
sample.labels['nodes']=[{'net': 'test', 'value': int(sample.value) }]
map_node.append( sample.labels )

output['node_map'] = map_node
Expand All @@ -192,10 +192,10 @@ async def main():

if node_testnet_count <= 2:
output['status']['testnet'] = "Severe"
output['statusmsgs']['testnet'].append(f"{node_testnet_count} / 4 nodes is available")
output['statusmsgs']['testnet'].append(f"{node_testnet_count} out of 4 nodes {'is' if node_testnet_count == 1 else 'are'} available")
elif node_testnet_count <= 3:
output['status']['testnet'] = "Degraded"
output['statusmsgs']['testnet'].append(f"{node_testnet_count} / 4 nodes is available")
output['statusmsgs']['testnet'].append(f"{node_testnet_count} out of 4 nodes {'is' if node_testnet_count == 1 else 'are'} available")
except:
# Connection error
output['status']['testnet'] = "Unknown"
Expand Down
2 changes: 1 addition & 1 deletion src/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ const Home = ({
key={statusMsgItem}
subtitle
size={6}
>{`- ${statusMsgItem}`}</Heading>
>{` ${statusMsgItem}`}</Heading>
))}
</Tile>
<Tile kind="ancestor" style={{ marginTop: '1.5rem' }} id="main">
Expand Down