diff --git a/pkg/cli/demo.go b/pkg/cli/demo.go index eaf5359010d4..1dbcbdbc4744 100644 --- a/pkg/cli/demo.go +++ b/pkg/cli/demo.go @@ -282,7 +282,7 @@ func runDemoInternal( // Only print details about the telemetry configuration if the // user has control over it. - if cluster.TelemetryOptOut() { + if cluster.TelemetryOptOut { cliCtx.PrintlnUnlessEmbedded("#\n# Telemetry disabled by configuration.") } else { cliCtx.PrintlnUnlessEmbedded("#\n" + diff --git a/pkg/clusterversion/cockroach_versions.go b/pkg/clusterversion/cockroach_versions.go index 9c69e3b31f85..f1a2c8266d95 100644 --- a/pkg/clusterversion/cockroach_versions.go +++ b/pkg/clusterversion/cockroach_versions.go @@ -615,6 +615,11 @@ const ( finalVersion = invalidVersionKey ) +// N.B. EnvOrDefaultBool has the desired side-effect of populating envVarRegistry.cache. +// It has to be invoked during init; otherwise, cli/start.go:reportConfiguration will not report the +// value of this environment variable in the server log, upon startup. +var allowUpgradeToDev = envutil.EnvOrDefaultBool("COCKROACH_UPGRADE_TO_DEV_VERSION", false) + var versionsSingleton = func() keyedVersions { if developmentBranch { // If this is a dev branch, we offset every version +1M major versions into @@ -639,7 +644,7 @@ var versionsSingleton = func() keyedVersions { // renumber only 2-4 to be +1M. It would then step from 3 "up" to 1000002 -- // which conceptually is actually back down to 2 -- then back to to 1000003, // then on to 1000004, etc. - skipFirst := envutil.EnvOrDefaultBool("COCKROACH_UPGRADE_TO_DEV_VERSION", false) + skipFirst := allowUpgradeToDev const devOffset = 1000000 first := true for i := range rawVersionsSingleton { diff --git a/pkg/roachprod/config/config.go b/pkg/roachprod/config/config.go index 59e7b54fd192..026ef51288a4 100644 --- a/pkg/roachprod/config/config.go +++ b/pkg/roachprod/config/config.go @@ -86,12 +86,11 @@ func DefaultEnvVars() []string { // when moving snapshots around, though. // (For other perf. related knobs, see https://github.com/cockroachdb/cockroach/issues/17165) "COCKROACH_ENABLE_RPC_COMPRESSION=false", - // Get rid of an annoying popup in the UI. - "COCKROACH_UI_RELEASE_NOTES_SIGNUP_DISMISSED=true", // Allow upgrading a stable release data-dir to a dev version. // N.B. many roachtests which perform upgrade scenarios require this env. var after changes in [1]; otherwise, // the tests will fail even on release branches when attempting to upgrade previous (stable) release to an alpha. // [1] https://github.com/cockroachdb/cockroach/pull/87468 + // TODO(SR): should remove this in light of https://github.com/cockroachdb/cockroach/issues/92608 "COCKROACH_UPGRADE_TO_DEV_VERSION=true", } } diff --git a/pkg/server/server.go b/pkg/server/server.go index 91570b5168ea..d982bacb3617 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -1724,7 +1724,7 @@ func (s *Server) PreStart(ctx context.Context) error { } // If enabled, start reporting diagnostics. - if s.cfg.StartDiagnosticsReporting && !cluster.TelemetryOptOut() { + if s.cfg.StartDiagnosticsReporting && !cluster.TelemetryOptOut { s.startDiagnostics(workersCtx) } diff --git a/pkg/server/tenant.go b/pkg/server/tenant.go index 9682ea4fb5ea..5710aa2c5c55 100644 --- a/pkg/server/tenant.go +++ b/pkg/server/tenant.go @@ -582,7 +582,7 @@ func (s *SQLServerWrapper) PreStart(ctx context.Context) error { } // If enabled, start reporting diagnostics. - if s.sqlServer.cfg.StartDiagnosticsReporting && !cluster.TelemetryOptOut() { + if s.sqlServer.cfg.StartDiagnosticsReporting && !cluster.TelemetryOptOut { s.startDiagnostics(workersCtx) } diff --git a/pkg/settings/cluster/cluster_settings.go b/pkg/settings/cluster/cluster_settings.go index b8f863e1fd3a..7a1721a772c1 100644 --- a/pkg/settings/cluster/cluster_settings.go +++ b/pkg/settings/cluster/cluster_settings.go @@ -69,11 +69,6 @@ type OverridesInformer interface { IsOverridden(settingName string) bool } -// TelemetryOptOut is a place for controlling whether to opt out of telemetry or not. -func TelemetryOptOut() bool { - return envutil.EnvOrDefaultBool("COCKROACH_SKIP_ENABLING_DIAGNOSTIC_REPORTING", false) -} - // NoSettings is used when a func requires a Settings but none is available // (for example, a CLI subcommand that does not connect to a cluster). var NoSettings *Settings // = nil @@ -92,6 +87,9 @@ const ( CPUProfileWithLabels ) +// TelemetryOptOut is a place for controlling whether to opt out of telemetry or not. +var TelemetryOptOut = envutil.EnvOrDefaultBool("COCKROACH_SKIP_ENABLING_DIAGNOSTIC_REPORTING", false) + // CPUProfileType returns the type of CPU profile being recorded, if any. // This can be used by moving parts across the system to add profiler labels // which are too expensive to be enabled at all times. If no profile is diff --git a/pkg/upgrade/upgrades/permanent_upgrades.go b/pkg/upgrade/upgrades/permanent_upgrades.go index 33f6f64e6790..8718b06a01c9 100644 --- a/pkg/upgrade/upgrades/permanent_upgrades.go +++ b/pkg/upgrade/upgrades/permanent_upgrades.go @@ -64,7 +64,7 @@ func optInToDiagnosticsStatReporting( ctx context.Context, _ clusterversion.ClusterVersion, deps upgrade.TenantDeps, ) error { // We're opting-out of the automatic opt-in. See discussion in updates.go. - if cluster.TelemetryOptOut() { + if cluster.TelemetryOptOut { return nil } _, err := deps.InternalExecutor.Exec(