Skip to content

Commit

Permalink
Do not run telemetry loops when it's disabled in config
Browse files Browse the repository at this point in the history
Telemetry can not be enabled by global variable when it's disabled in
config file. Therefore we don't need to run telemetry related loops at
all when telemetry is disable from global config.

Signed-off-by: Xiaoguang Sun <[email protected]>
  • Loading branch information
sunxiaoguang authored and ti-chi-bot committed Feb 7, 2023
1 parent 45f2d06 commit c4622ad
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -3340,10 +3340,14 @@ 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.
go func() {
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
go func() {
dom.TelemetryReportLoop(ses[5])
dom.TelemetryRotateSubWindowLoop(ses[5])
}()
}
}

// setup plan replayer handle
Expand Down

0 comments on commit c4622ad

Please sign in to comment.