Skip to content

Commit 195fa11

Browse files
author
Johan Steyn
authored
CLOUDP-120923: [Atlas CLI] Telemetry - Add Feature Flag (#1151)
1 parent f08e168 commit 195fa11

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

internal/config/profile.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,15 +456,24 @@ func (p *Profile) IsTelemetryEnabledSet() bool {
456456
// TelemetryEnabled get the configured telemetry enabled value.
457457
func TelemetryEnabled() bool { return Default().TelemetryEnabled() }
458458
func (p *Profile) TelemetryEnabled() bool {
459+
if ToolName != AtlasCLI || !isTelemetryFeatureFlagSet() {
460+
return false
461+
}
459462
return p.GetBool(telemetryEnabled)
460463
}
461464

462465
// SetTelemetryEnabled sets the telemetry enabled value.
463466
func SetTelemetryEnabled(v bool) { Default().SetTelemetryEnabled(v) }
464467
func (p *Profile) SetTelemetryEnabled(v bool) {
465-
if ToolName == AtlasCLI {
466-
SetGlobal(telemetryEnabled, v)
468+
if ToolName != AtlasCLI || !isTelemetryFeatureFlagSet() {
469+
return
467470
}
471+
SetGlobal(telemetryEnabled, v)
472+
}
473+
474+
func isTelemetryFeatureFlagSet() bool {
475+
_, featureFlagSet := os.LookupEnv("MONGODB_ATLAS_TELEMETRY_FEATURE_FLAG")
476+
return featureFlagSet
468477
}
469478

470479
// Output get configured output format.

0 commit comments

Comments
 (0)