diff --git a/session/session.go b/session/session.go index f0484876a3c90..79897a1bd96e5 100644 --- a/session/session.go +++ b/session/session.go @@ -2928,8 +2928,12 @@ 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]) + if config.GetGlobalConfig().EnableTelemetry { + // There is no way to turn telemetry on with global variable `tidb_enable_telemetry` + // when it is disabled in config. See IsTelemetryEnabled function in telemetry/telemetry.go + dom.TelemetryReportLoop(ses[5]) + dom.TelemetryRotateSubWindowLoop(ses[5]) + } } // A sub context for update table stats, and other contexts for concurrent stats loading.