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

Add uptime metric to TIDB status API #5979

Open
jomenxiao opened this issue Mar 8, 2018 · 5 comments
Open

Add uptime metric to TIDB status API #5979

jomenxiao opened this issue Mar 8, 2018 · 5 comments
Labels
feature/accepted This feature request is accepted by product managers good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/feature-request Categorizes issue or PR as related to a new feature.

Comments

@jomenxiao
Copy link

How to know TiDB restarted?(startTS or Uptime)
How to get all of TiDB's status?

@jomenxiao
Copy link
Author

#4989

@jackysp
Copy link
Member

jackysp commented Mar 8, 2018

Good idea, @jomenxiao . We'll consider your advice.

@shenli shenli added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Apr 5, 2018
@morgo
Copy link
Contributor

morgo commented Dec 29, 2018

See also: #8842 (mysql compatible way)

@ghost
Copy link

ghost commented Aug 3, 2020

Uptime information for components is available in Prometheus. The status port does not explicitly have an uptime metric, but it does expose a start_timestamp at /info.

I am going to leave this request open for an uptime metric. It may be useful to have it pre-computed.

@ghost ghost added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. type/feature-request Categorizes issue or PR as related to a new feature. labels Aug 3, 2020
@ghost ghost changed the title [featrue]Add TiDB status API Add uptime metric to TIDB status API Aug 3, 2020
@zz-jason zz-jason added the feature/accepted This feature request is accepted by product managers label Aug 6, 2020
@dveeden
Copy link
Contributor

dveeden commented Nov 15, 2021

$ etcdctl get --print-value-only /topology/tidb/127.0.0.1:4000/info | jq '.start_timestamp'
1636957939
$ curl -s http://127.0.0.1:10080/info | jq '.start_timestamp'
1636957939
mysql> SELECT START_TIME, UPTIME FROM information_schema.CLUSTER_INFO WHERE INSTANCE='127.0.0.1:4000';
+---------------------------+------------------+
| START_TIME                | UPTIME           |
+---------------------------+------------------+
| 2021-11-15T07:32:19+01:00 | 55m15.629421432s |
+---------------------------+------------------+
1 row in set (0.01 sec)

(see also #29771 )

However there is a slight issue with this start_timestamp: it is coming from etcd, which doesn't work when running in unistore instead of TiKV/PD. In that case getServerInfo will use time.Now().Unix() instead, so it always shows an uptime of less than a second.

Is the information_schema.CLUSTER_INFO and per-instance start_timestamp from the HTTP API sufficient? Both the information_schema and etcd query will give information about all instances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/accepted This feature request is accepted by product managers good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/feature-request Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

6 participants