telemetry: Initialize telemetry asynchronously (#35898)

close pingcap/tidb#35897
This commit is contained in:
Xiaoguang Sun
2022-07-06 17:35:02 +08:00
committed by GitHub
parent a5e973ca5a
commit 562b033689

View File

@ -2879,8 +2879,10 @@ func BootstrapSession(store kv.Storage) (*domain.Domain, error) {
if dom.GetEtcdClient() != nil {
// We only want telemetry data in production-like clusters. When TiDB is deployed over other engines,
// for example, unistore engine (used for local tests), we just skip it. Its etcd client is nil.
dom.TelemetryReportLoop(ses[5])
dom.TelemetryRotateSubWindowLoop(ses[5])
go func() {
dom.TelemetryReportLoop(ses[5])
dom.TelemetryRotateSubWindowLoop(ses[5])
}()
}
// A sub context for update table stats, and other contexts for concurrent stats loading.