Skip to content

CLOUDP-120923: [Atlas CLI] Telemetry - Add Feature Flag #1151

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

Merged
merged 1 commit into from
Apr 27, 2022
Merged
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
13 changes: 11 additions & 2 deletions internal/config/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,15 +456,24 @@ func (p *Profile) IsTelemetryEnabledSet() bool {
// TelemetryEnabled get the configured telemetry enabled value.
func TelemetryEnabled() bool { return Default().TelemetryEnabled() }
func (p *Profile) TelemetryEnabled() bool {
if ToolName != AtlasCLI || !isTelemetryFeatureFlagSet() {
return false
}
return p.GetBool(telemetryEnabled)
}

// SetTelemetryEnabled sets the telemetry enabled value.
func SetTelemetryEnabled(v bool) { Default().SetTelemetryEnabled(v) }
func (p *Profile) SetTelemetryEnabled(v bool) {
if ToolName == AtlasCLI {
SetGlobal(telemetryEnabled, v)
if ToolName != AtlasCLI || !isTelemetryFeatureFlagSet() {
return
}
SetGlobal(telemetryEnabled, v)
}

func isTelemetryFeatureFlagSet() bool {
_, featureFlagSet := os.LookupEnv("MONGODB_ATLAS_TELEMETRY_FEATURE_FLAG")
return featureFlagSet
}
Comment on lines +474 to 477
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not how we do env vars, please use viper

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johansteyn As this has already been merged, can you make a follow up ticket to do the cleanup? Thanks!


// Output get configured output format.
Expand Down