added node avg propagation time
This commit is contained in:
parent
f7186e0b3c
commit
6e3fb3559d
@ -27,6 +27,7 @@ var Node = function Node(data)
|
|||||||
uncles: []
|
uncles: []
|
||||||
},
|
},
|
||||||
blocktimeAvg: 0,
|
blocktimeAvg: 0,
|
||||||
|
propagationAvg: 0,
|
||||||
blockTimes: [],
|
blockTimes: [],
|
||||||
difficulty: [],
|
difficulty: [],
|
||||||
latency: 0,
|
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')
|
if(typeof stats !== 'undefined' && typeof stats.block !== 'undefined' && typeof stats.block.number !== 'undefined')
|
||||||
{
|
{
|
||||||
this.history = history;
|
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;
|
this.stats = stats;
|
||||||
|
|
||||||
return this.getStats();
|
return this.getStats();
|
||||||
|
@ -174,6 +174,23 @@ angular.module('netStatsApp.filters', [])
|
|||||||
return 'text-danger'
|
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() {
|
.filter('latencyFilter', function() {
|
||||||
return function(stats) {
|
return function(stats) {
|
||||||
if(stats.active === false)
|
if(stats.active === false)
|
||||||
|
@ -174,6 +174,8 @@ block content
|
|||||||
th.th-peerPropagationTime
|
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)")
|
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-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
|
th
|
||||||
i.icon-bulb(data-toggle="tooltip", data-placement="top", title="Up-time", ng-click="orderTable(['-stats.active', '-stats.uptime'], false)")
|
i.icon-bulb(data-toggle="tooltip", data-placement="top", title="Up-time", ng-click="orderTable(['-stats.active', '-stats.uptime'], false)")
|
||||||
tbody(ng-cloak)
|
tbody(ng-cloak)
|
||||||
@ -203,4 +205,5 @@ block content
|
|||||||
div.propagationBox
|
div.propagationBox
|
||||||
span {{node.stats.block.propagation | blockPropagationFilter}}
|
span {{node.stats.block.propagation | blockPropagationFilter}}
|
||||||
td.peerPropagationChart(class="{{node.id}}")
|
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 }}
|
td(class="{{ node.stats.uptime | upTimeClass : node.stats.active }}") {{ node.stats.uptime | upTimeFilter }}
|
||||||
|
Loading…
Reference in New Issue
Block a user