This repository was archived by the owner on Sep 25, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +27
-7
lines changed
Expand file tree Collapse file tree 6 files changed +27
-7
lines changed Original file line number Diff line number Diff line change 2121
2222var fs = require ( 'fs' ) ;
2323
24+ var _ = require ( 'underscore' ) ;
2425var async = require ( 'async' ) ;
2526var AdminClient = require ( './admin-client.js' ) ;
2627var Partition = require ( './partition.js' ) ;
@@ -231,6 +232,11 @@ Cluster.prototype.parseStats = function parseStats(stats) {
231232 cluster . membershipChecksum = stats . membershipChecksum ;
232233 cluster . membership = stats . members ;
233234
235+ var membersByStatus = _ . groupBy ( stats . members , 'status' ) ;
236+ cluster . aliveCount = _ . size ( membersByStatus . alive ) ;
237+ cluster . suspectCount = _ . size ( membersByStatus . suspect ) ;
238+ cluster . faultyCount = _ . size ( membersByStatus . faulty ) ;
239+
234240 this . partitions [ cluster . membershipChecksum ] = cluster ;
235241 }
236242
Original file line number Diff line number Diff line change @@ -24,6 +24,9 @@ function Partition() {
2424 this . membership = null ;
2525 this . nodes = [ ] ;
2626 this . nodeCount = 0 ;
27+ this . aliveCount = 0 ;
28+ this . suspectCount = 0 ;
29+ this . faultyCount = 0 ;
2730}
2831
2932Partition . prototype . addNode = function addNode ( node ) {
Original file line number Diff line number Diff line change 3131 "cli-table" : " ^0.3.1" ,
3232 "commander" : " ^2.6.0" ,
3333 "ringpop" : " ^10.0.0" ,
34- "tchannel" : " 2.7.4"
34+ "tchannel" : " 2.7.4" ,
35+ "underscore" : " ^1.8.3"
3536 },
3637 "devDependencies" : {
3738 "cli-color" : " ^0.3.3" ,
Original file line number Diff line number Diff line change @@ -45,13 +45,23 @@ function main() {
4545 headers = [
4646 'Checksum' ,
4747 '# Nodes' ,
48+ '# Alive' ,
49+ '# Suspect' ,
50+ '# Faulty' ,
4851 'Sample Host'
4952 ] ;
5053 }
5154
5255 var table = createTable ( headers ) ;
5356 partitions . forEach ( function each ( partition ) {
54- table . push ( [ partition . membershipChecksum , partition . nodeCount , String ( partition . nodes [ 0 ] ) ] ) ;
57+ table . push ( [
58+ partition . membershipChecksum ,
59+ partition . nodeCount ,
60+ partition . aliveCount ,
61+ partition . suspectCount ,
62+ partition . faultyCount ,
63+ String ( partition . nodes [ 0 ] )
64+ ] ) ;
5565 } ) ;
5666 console . log ( table . toString ( ) ) ;
5767 process . exit ( ) ;
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ Invalid bootstrap file
2020
2121 $ ringpop-admin checksums QWERTY
2222
23- assert. js: 93
23+ assert. js:* (glob)
2424 throw new assert. AssertionError({
2525 ^
2626 AssertionError: invalid destination
Original file line number Diff line number Diff line change 11Partitions command success:
22
33 $ ringpop-admin partitions 127.0 . 0. 1: 3000
4- Checksum # Nodes Sample Host* (glob)
5- * 5 127.0 . 0. 1: 3000 * (glob)
4+ Checksum* # Nodes*# Alive*# Suspect*# Faulty* Sample Host* (glob)
5+ * 5 * 5 * 0 * 0 * 127.0 . 0. 1: 3000 * (glob)
66
77
88With bootstrap file:
99
1010 $ ringpop-admin partitions $ TESTDIR / hosts. json
11- Checksum # Nodes Sample Host* (glob)
12- * 5 127.0 . 0. 1:* (glob)
11+ Checksum* # Nodes*# Alive*# Suspect*# Faulty* Sample Host* (glob)
12+ * 5 * 5 * 0 * 0 * 127.0 . 0. 1:* (glob)
1313
1414
1515Unable to connect to host:
You can’t perform that action at this time.
0 commit comments