natscli icon indicating copy to clipboard operation
natscli copied to clipboard

Server report displays time since epoch when node not active

Open wallyqs opened this issue 3 years ago • 1 comments

In case a node is not active the report shows humanizes the result of time.Since(time.Unix(0,0)) so gets displayed in years:

+---------------------------------------------------------+
|               RAFT Meta Group Information               |
+------+--------+---------+--------+----------------+-----+
| Name | Leader | Current | Online | Active         | Lag |
+------+--------+---------+--------+----------------+-----+
| A    |        | true    | true   | 0.36s          | 0   |
| B    | yes    | true    | true   | 0.00s          | 0   |
| C    |        | false   | false  | 51y83d6h10m28s | 14  |
| D    |        | false   | false  | 7m23s          | 14  |
| E    |        | true    | true   | 0.36s          | 0   |
+------+--------+---------+--------+----------------+-----+

maybe could display unknown or -?

+---------------------------------------------------------+
|               RAFT Meta Group Information               |
+------+--------+---------+--------+----------------+-----+
| Name | Leader | Current | Online | Active         | Lag |
+------+--------+---------+--------+----------------+-----+
| A    |        | true    | true   | 0.36s          | 0   |
| B    | yes    | true    | true   | 0.00s          | 0   |
| C    |        | false   | false  | -              | 14  |
| D    |        | false   | false  | 7m23s          | 14  |
| E    |        | true    | true   | 0.36s          | 0   |
+------+--------+---------+--------+----------------+-----+
nats -s nats://sys:[email protected]:4222 server report jetstream 5 --trace
22:10:28 >>> $SYS.REQ.SERVER.PING.JSZ: {}
22:10:28 <<< {"data":{"server_id":"NDNJ4EA6VJOU3AX3QBTCGGBNAPZAXGM6ON2UZP73BE7YZCMV64BETW5I","now":"2021-03-12T06:10:28.823705Z","config":{"max_memory":6442450944,"max_storage":456062287872,"store_dir":"nodes/A/jetstream"},"memory":0,"storage":0,"api":{"total":176,"errors":32},"current_api_calls":0,"meta_cluster":{"name":"ABC","leader":"B","replicas":[{"name":"D","current":false,"offline":true,"active":337619352000,"lag":1},{"name":"B","current":true,"active":359040000,"lag":1},{"name":"E","current":false,"active":240190733000,"lag":14},{"name":"C","current":false,"offline":true,"active":778235578000,"lag":14}]}},"server":{"name":"A","host":"0.0.0.0","id":"NDNJ4EA6VJOU3AX3QBTCGGBNAPZAXGM6ON2UZP73BE7YZCMV64BETW5I","cluster":"ABC","ver":"2.2.0-RC.8","seq":25904,"jetstream":true,"time":"2021-03-12T06:10:28.823775Z"}}
22:10:28 <<< {"data":{"server_id":"NCUWG26LWK4OVMW6FURORX4C3HS5IFQJWLDDWXYL6XUEC2FCKZGNPPRX","now":"2021-03-12T06:10:28.823826Z","config":{"max_memory":-1,"max_storage":-1,"store_dir":"./nodes/E"},"memory":0,"storage":0,"api":{"total":4,"errors":4},"current_api_calls":0,"meta_cluster":{"name":"ABC","leader":"B","replicas":[{"name":"B","current":true,"active":359162000,"lag":14},{"name":"A","current":false,"active":240190701000,"lag":14},{"name":"C","current":false,"offline":true,"active":1615529428823841000,"lag":14},{"name":"D","current":false,"offline":true,"active":1615529428823841000,"lag":14}]}},"server":{"name":"E","host":"0.0.0.0","id":"NCUWG26LWK4OVMW6FURORX4C3HS5IFQJWLDDWXYL6XUEC2FCKZGNPPRX","cluster":"ABC","ver":"2.2.0-RC.8","seq":2046,"jetstream":true,"time":"2021-03-12T06:10:28.823856Z"}}
22:10:28 <<< {"data":{"server_id":"ND2GVEEXLVAQMWBXQM6FZRBFLPFELETDHC75JYFNM7255EGW5NTHFN5M","now":"2021-03-12T06:10:28.823901Z","config":{"max_memory":-1,"max_storage":-1,"store_dir":"./nodes/B"},"memory":0,"storage":479165,"api":{"total":368,"errors":138},"current_api_calls":0,"total_streams":1,"total_messages":10195,"total_message_bytes":479165,"meta_cluster":{"name":"ABC","leader":"B","replicas":[{"name":"A","current":true,"active":359185000},{"name":"C","current":false,"offline":true,"active":1615529428823921000,"lag":14},{"name":"D","current":false,"offline":true,"active":443238313000,"lag":14},{"name":"E","current":true,"active":359168000}]}},"server":{"name":"B","host":"0.0.0.0","id":"ND2GVEEXLVAQMWBXQM6FZRBFLPFELETDHC75JYFNM7255EGW5NTHFN5M","cluster":"ABC","ver":"2.2.0-RC.8","seq":2109,"jetstream":true,"time":"2021-03-12T06:10:28.823937Z"}}

wallyqs avatar Mar 12 '21 06:03 wallyqs