Skip to content

Commit

Permalink
Rename disable_telemetry to enable_telemetry (#684)
Browse files Browse the repository at this point in the history
  • Loading branch information
HunDunDM authored Jul 13, 2020
1 parent 5af71fe commit d11799e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmd/tidb-dashboard/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func NewCLIConfig() *DashboardCLIConfig {
flag.StringVar(&cfg.CoreConfig.DataDir, "data-dir", "/tmp/dashboard-data", "path to the Dashboard Server data directory")
flag.StringVar(&cfg.CoreConfig.PublicPathPrefix, "path-prefix", config.DefaultPublicPathPrefix, "public URL path prefix for reverse proxies")
flag.StringVar(&cfg.CoreConfig.PDEndPoint, "pd", "http://127.0.0.1:2379", "PD endpoint address that Dashboard Server connects to")
flag.BoolVar(&cfg.CoreConfig.DisableTelemetry, "disable-telemetry", false, "disable client to report data")
flag.BoolVar(&cfg.CoreConfig.EnableTelemetry, "enable-telemetry", true, "enable client to report data for analysis")

showVersion := flag.BoolP("version", "v", false, "print version information and exit")

Expand Down
10 changes: 4 additions & 6 deletions pkg/apiserver/info/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ func Register(r *gin.RouterGroup, auth *user.AuthService, s *Service) {
}

type InfoResponse struct { //nolint:golint
Version *version.Info `json:"version"`
PDEndPoint string `json:"pd_end_point"`
DisableTelemetry bool `json:"disable_telemetry"`
Version *version.Info `json:"version"`
EnableTelemetry bool `json:"enable_telemetry"`
}

// @Summary Dashboard info
Expand All @@ -62,9 +61,8 @@ type InfoResponse struct { //nolint:golint
// @Failure 401 {object} utils.APIError "Unauthorized failure"
func (s *Service) infoHandler(c *gin.Context) {
resp := InfoResponse{
Version: version.GetInfo(),
PDEndPoint: s.config.PDEndPoint,
DisableTelemetry: s.config.DisableTelemetry,
Version: version.GetInfo(),
EnableTelemetry: s.config.EnableTelemetry,
}
c.JSON(http.StatusOK, resp)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ type Config struct {
// TLS config for mTLS authentication between TiDB and MySQL client.
TiDBTLSConfig *tls.Config

// Disable client to report data for analysis
DisableTelemetry bool
// Enable client to report data for analysis
EnableTelemetry bool
}

func (c *Config) NormalizePDEndPoint() error {
Expand Down
2 changes: 1 addition & 1 deletion ui/lib/utils/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function init(info: InfoInfoResponse) {
mixpanel.init(token, options)
// disable mixpanel to report data immediately
mixpanel.opt_out_tracking()
if (info?.disable_telemetry === false) {
if (info?.enable_telemetry) {
mixpanel.register({
$current_url: getPathInLocationHash(),
})
Expand Down

0 comments on commit d11799e

Please sign in to comment.