Skip to content

Commit

Permalink
feat(webapp): add average cpu and net usage stats
Browse files Browse the repository at this point in the history
  • Loading branch information
Torresmorah committed Jul 11, 2023
1 parent 9887b7f commit c7d6721
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 7 deletions.
46 changes: 44 additions & 2 deletions webapp/src/components/TransactionsHistory/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const TransactionsHistory = ({ t, nodesChildren }) => {
<SimpleDataCard>
<Typography>{t('cpuUtilizationAllTimeHigh')}</Typography>
<BodyGraphValue
value={data?.stats[0]?.tps_all_time_high?.cpu_usage || 0}
value={`${data?.stats[0]?.tps_all_time_high?.cpu_usage || 0} %`}
classes={classes}
href={getBlockNumUrl(
data?.stats?.[0]?.tps_all_time_high?.blocks[0],
Expand All @@ -79,7 +79,7 @@ const TransactionsHistory = ({ t, nodesChildren }) => {
<SimpleDataCard>
<Typography>{t('networkUtilizationAllTimeHigh')}</Typography>
<BodyGraphValue
value={data?.stats[0]?.tps_all_time_high?.net_usage || 0}
value={`${data?.stats[0]?.tps_all_time_high?.net_usage || 0} %`}
classes={classes}
href={getBlockNumUrl(
data?.stats?.[0]?.tps_all_time_high?.blocks[0],
Expand Down Expand Up @@ -126,6 +126,48 @@ const TransactionsHistory = ({ t, nodesChildren }) => {
loading={loading}
/>
</SimpleDataCard>
<SimpleDataCard>
<Typography>{`${t('cpuUtilization')} ${t('lastHour')}`}</Typography>
<BodyGraphValue
value={`${data?.stats?.[0]?.average_cpu_usage_in_hour || 0} %`}
loading={loading}
/>
</SimpleDataCard>
<SimpleDataCard>
<Typography>{`${t('cpuUtilization')} ${t('lastDay')}`}</Typography>
<BodyGraphValue
value={`${data?.stats?.[0]?.average_cpu_usage_in_last_day || 0} %`}
loading={loading}
/>
</SimpleDataCard>
<SimpleDataCard>
<Typography>{`${t('cpuUtilization')} ${t('lastWeek')}`}</Typography>
<BodyGraphValue
value={`${data?.stats?.[0]?.average_cpu_usage_in_week || 0} %`}
loading={loading}
/>
</SimpleDataCard>
<SimpleDataCard>
<Typography>{`${t('netUtilization')} ${t('lastHour')}`}</Typography>
<BodyGraphValue
value={`${data?.stats?.[0]?.average_net_usage_in_hour || 0} %`}
loading={loading}
/>
</SimpleDataCard>
<SimpleDataCard>
<Typography>{`${t('netUtilization')} ${t('lastDay')}`}</Typography>
<BodyGraphValue
value={`${data?.stats?.[0]?.average_net_usage_in_last_day || 0} %`}
loading={loading}
/>
</SimpleDataCard>
<SimpleDataCard>
<Typography>{`${t('netUtilization')} ${t('lastWeek')}`}</Typography>
<BodyGraphValue
value={`${data?.stats?.[0]?.average_net_usage_in_week || 0} %`}
loading={loading}
/>
</SimpleDataCard>
</>
)}
{nodesChildren && (
Expand Down
6 changes: 6 additions & 0 deletions webapp/src/gql/producer.gql.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ export const BLOCK_TRANSACTIONS_HISTORY = gql`
transactions_in_last_day
transactions_in_last_week
average_daily_transactions_in_last_week
average_cpu_usage_in_last_day
average_net_usage_in_last_day
average_cpu_usage_in_last_hour
average_net_usage_in_last_hour
average_cpu_usage_in_last_week
average_net_usage_in_last_week
tps_all_time_high
unique_locations
missed_blocks
Expand Down
6 changes: 4 additions & 2 deletions webapp/src/language/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@
"scheduleVersion": "Schedule Version",
"secondsAgo": "Seconds Ago",
"tpsAllTimeHigh": "TPS All Time High",
"cpuUtilizationAllTimeHigh": "CPU Utilization All Time High",
"networkUtilizationAllTimeHigh": "Network Utilization All Time High",
"cpuUtilization": "CPU Usage",
"netUtilization": "NET Usage",
"cpuUtilizationAllTimeHigh": "CPU Usage All Time High",
"networkUtilizationAllTimeHigh": "NET Usage All Time High",
"transactionsPerSecond": "Transactions per Second",
"transactionsPerBlock": "Transactions per Block",
"nodes": "Nodes",
Expand Down
8 changes: 5 additions & 3 deletions webapp/src/language/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@
"Last Year": "Último Año",
"scheduleVersion": "Versión de Programa",
"secondsAgo": "Hace Segundos",
"cpuUtilizationAllTimeHigh": "Máxima utilización de cpu",
"networkUtilizationAllTimeHigh": "Máxima utilización de la red",
"cpuUtilization": "Uso de CPU",
"netUtilization": "Uso de NET",
"cpuUtilizationAllTimeHigh": "Máxima uso de CPU",
"networkUtilizationAllTimeHigh": "Máxima uso de NET",
"tpsAllTimeHigh": "TPS máximo histórico",
"transactionsPerSecond": "Transacciones por segundo",
"transactionsPerBlock": "Transacciones por bloque",
Expand All @@ -157,7 +159,7 @@
"transactions": "Transacciones",
"uniqueLocations": "Ubicaciones únicas",
"cpuLimitPerBlock": "Límite de CPU por bloque",
"netLimitPerBlock": "Límite Red por bloque",
"netLimitPerBlock": "Límite NET por bloque",
"chainCpuLimit": "Límite de CPU en cadena",
"chainNetLimit": "Límite de Net en cadena",
"timeToFinality": "Tiempo para finalidad",
Expand Down

0 comments on commit c7d6721

Please sign in to comment.