Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename disable_telemetry to enable_telemetry #684

Merged
merged 4 commits into from
Jul 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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