Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server report displays time since epoch when node not active #113

Open
wallyqs opened this issue Mar 12, 2021 · 1 comment
Open

Server report displays time since epoch when node not active #113

wallyqs opened this issue Mar 12, 2021 · 1 comment

Comments

@wallyqs
Copy link
Member

wallyqs commented Mar 12, 2021

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"}}

@ripienaar
Copy link
Collaborator

ripienaar commented Mar 12, 2021

problem is, as you can see with D some offline ones do have a legit active time and it's useful. So probably I should add some kind of threshold since obviously 51 years is too long - but whats a sane threshold.

If the server returned math.MaxInt64 like it does for some other cases like this the duration formatting would have returned "never" here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants