How to obtain the time when a new PD leader is successfully elected

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 如何获取新 pd leader 选举成功的时间

| username: MrSylar

If there is a leader switch in PD at a certain moment, besides the logs, is there any other way to check the time when the new PD leader was successfully elected?

| username: forever | Original post link

Take a look in Grafana.

| username: 这里介绍不了我 | Original post link

Overview → PD → Region health This can also give a rough time estimate. This article contains some content about PD switching that you can take a look at Column - Troubleshooting: PD Leader Switching, a certain TiKV Leader was evicted | TiDB Community

| username: tidb菜鸟一只 | Original post link

Just filter the keywords further.

| username: MrSylar | Original post link

Finally, we used metrics_schema.pd_role.

| username: 濱崎悟空 | Original post link


| username: ziptoam | Original post link

Take a look at this: