Skip to content

Commit 18b6a6a

Browse files
committed
server/profiler: remove server.cpu_profile.enabled setting
Cpu profiling can be enabled by setting the cluster setting `server.cpu_profile.cpu_usage_combined_threshold`. This makes `server.cpu_profile.enabled` redundant and makes it more difficult and confusing to enable cpu profiling. This commit removes the `server.cpu_profile.enabled` setting entirely. Note that both jdefault values for the cluster settings set profiling off. Closes: cockroachdb#102024 Release note (sql change): The cluster setting `server.cpu_profile.enabled` has been removed. `server.cpu_profile.cpu_usage_combined_threshold` can enable and disable cpu profiling.
1 parent 400105c commit 18b6a6a

File tree

3 files changed

+1
-13
lines changed

3 files changed

+1
-13
lines changed

pkg/server/profiler/cpuprofile_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ func TestCPUProfiler(t *testing.T) {
3131
sv.Init(ctx, s.Version)
3232
cpuProfileInterval.Override(ctx, sv, time.Hour)
3333
cpuUsageCombined.Override(ctx, sv, 80)
34-
cpuProfileEnabled.Override(ctx, sv, true)
3534
pastTime := time.Date(2023, 1, 1, 1, 1, 1, 1, time.UTC)
3635
cases := []struct {
3736
name string

pkg/server/profiler/cpuprofiler.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,6 @@ var cpuProfileDuration = settings.RegisterDurationSetting(
6161
10*time.Second, settings.PositiveDuration,
6262
)
6363

64-
var cpuProfileEnabled = settings.RegisterBoolSetting(
65-
settings.TenantWritable,
66-
"server.cpu_profile.enabled",
67-
"a bool which indicates whether cpu profiles should be taken by the cpu profiler. "+
68-
"in order to have the profiler function, server.cpu_profile.cpu_usage_combined_threshold "+
69-
"must also be set to a realistic value",
70-
false,
71-
)
72-
7364
const cpuProfFileNamePrefix = "cpuprof"
7465

7566
// CPUProfiler is used to take CPU profiles.
@@ -116,9 +107,6 @@ func (cp *CPUProfiler) MaybeTakeProfile(ctx context.Context, currentCpuUsage int
116107
logcrash.ReportPanic(ctx, &cp.st.SV, p, 1)
117108
}
118109
}()
119-
if !cpuProfileEnabled.Get(&cp.st.SV) {
120-
return
121-
}
122110
cp.profiler.maybeTakeProfile(ctx, currentCpuUsage, cp.takeCPUProfile)
123111
}
124112

pkg/settings/registry.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ var retiredSettings = map[string]struct{}{
173173
"changefeed.replan_flow_threshold": {},
174174
"jobs.trace.force_dump_mode": {},
175175
"timeseries.storage.30m_resolution_ttl": {},
176+
"server.cpu_profile.enabled": {},
176177
}
177178

178179
// sqlDefaultSettings is the list of "grandfathered" existing sql.defaults

0 commit comments

Comments
 (0)