added node avg propagation time
This commit is contained in:
parent
f7186e0b3c
commit
6e3fb3559d
@ -27,6 +27,7 @@ var Node = function Node(data)
|
||||
uncles: []
|
||||
},
|
||||
blocktimeAvg: 0,
|
||||
propagationAvg: 0,
|
||||
blockTimes: [],
|
||||
difficulty: [],
|
||||
latency: 0,
|
||||
@ -108,6 +109,16 @@ Node.prototype.setStats = function(stats, history)
|
||||
if(typeof stats !== 'undefined' && typeof stats.block !== 'undefined' && typeof stats.block.number !== 'undefined')
|
||||
{
|
||||
this.history = history;
|
||||
|
||||
var positives = _.filter(history, function(p) {
|
||||
return p >= 0;
|
||||
});
|
||||
|
||||
if(positives.length > 0)
|
||||
stats.propagationAvg = Math.round(_.sum(positives)/positives.length);
|
||||
else
|
||||
stats.propagationAvg = 0;
|
||||
|
||||
this.stats = stats;
|
||||
|
||||
return this.getStats();
|
||||
|
@ -174,6 +174,23 @@ angular.module('netStatsApp.filters', [])
|
||||
return 'text-danger'
|
||||
};
|
||||
})
|
||||
.filter('propagationAvgTimeClass', function() {
|
||||
return function(propagation) {
|
||||
if(propagation == 0)
|
||||
return 'text-info';
|
||||
|
||||
if(propagation < 1000)
|
||||
return 'text-success';
|
||||
|
||||
if(propagation < 3000)
|
||||
return 'text-warning';
|
||||
|
||||
if(propagation < 7000)
|
||||
return 'text-orange';
|
||||
|
||||
return 'text-danger'
|
||||
};
|
||||
})
|
||||
.filter('latencyFilter', function() {
|
||||
return function(stats) {
|
||||
if(stats.active === false)
|
||||
|
@ -174,6 +174,8 @@ block content
|
||||
th.th-peerPropagationTime
|
||||
i.icon-gas(data-toggle="tooltip", data-placement="top", title="Propagation time", ng-click="orderTable(['-stats.active', '-stats.block.number', 'stats.block.propagation'], false)")
|
||||
th.th-peerPropagationChart
|
||||
th.th-peerPropagationAvg
|
||||
i.icon-gas(data-toggle="tooltip", data-placement="top", title="Average propagation time", ng-click="orderTable(['-stats.active', 'stats.propagationAvg'], false)")
|
||||
th
|
||||
i.icon-bulb(data-toggle="tooltip", data-placement="top", title="Up-time", ng-click="orderTable(['-stats.active', '-stats.uptime'], false)")
|
||||
tbody(ng-cloak)
|
||||
@ -203,4 +205,5 @@ block content
|
||||
div.propagationBox
|
||||
span {{node.stats.block.propagation | blockPropagationFilter}}
|
||||
td.peerPropagationChart(class="{{node.id}}")
|
||||
td(class="{{ node.stats.propagationAvg | propagationAvgTimeClass }}") {{ node.stats.propagationAvg | blockPropagationFilter }}
|
||||
td(class="{{ node.stats.uptime | upTimeClass : node.stats.active }}") {{ node.stats.uptime | upTimeFilter }}
|
||||
|
Loading…
Reference in New Issue
Block a user