Skip to content

Commit 32ded2e

Browse files
committed
Revert "Merge pull request #4401 from DataDog/ivoanjo/prof-11394-heap-profiler-preview"
This reverts commit 6f63c6d, reversing changes made to 5e20f11.
1 parent 6fa4413 commit 32ded2e

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

lib/datadog/core/configuration/settings.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def initialize(*_)
313313

314314
# Can be used to enable/disable the collection of heap profiles.
315315
#
316-
# This feature is in preview and disabled by default. Requires Ruby 3.1+.
316+
# This feature is alpha and disabled by default
317317
#
318318
# @warn To enable heap profiling you are required to also enable allocation profiling.
319319
#
@@ -326,12 +326,12 @@ def initialize(*_)
326326

327327
# Can be used to enable/disable the collection of heap size profiles.
328328
#
329-
# This feature is in preview and by default is enabled whenever heap profiling is enabled.
329+
# This feature is alpha and enabled by default when heap profiling is enabled.
330330
#
331-
# @warn Heap size profiling depends on allocation and heap profiling, so they must be enabled as well.
331+
# @warn To enable heap size profiling you are required to also enable allocation and heap profiling.
332332
#
333-
# @default `DD_PROFILING_EXPERIMENTAL_HEAP_SIZE_ENABLED` environment variable as a boolean, otherwise it
334-
# follows the value of `experimental_heap_enabled`.
333+
# @default `DD_PROFILING_EXPERIMENTAL_HEAP_SIZE_ENABLED` environment variable as a boolean, otherwise
334+
# whatever the value of DD_PROFILING_EXPERIMENTAL_HEAP_ENABLED is.
335335
option :experimental_heap_size_enabled do |o|
336336
o.type :bool
337337
o.env 'DD_PROFILING_EXPERIMENTAL_HEAP_SIZE_ENABLED'

lib/datadog/profiling/component.rb

+9-6
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,13 @@ def self.build_profiler_component(settings:, agent_settings:, optional_tracer:,
221221
end
222222

223223
unless allocation_profiling_enabled
224-
logger.warn(
225-
"Heap profiling was requested but allocation profiling is not enabled. " \
226-
"Heap profiling has been disabled."
227-
)
228-
return false
224+
raise ArgumentError, "Heap profiling requires allocation profiling to be enabled"
229225
end
230226

231-
logger.debug("Enabled heap profiling: heap_sample_rate=#{heap_sample_rate}")
227+
logger.warn(
228+
"Enabled experimental heap profiling: heap_sample_rate=#{heap_sample_rate}. This is experimental, not " \
229+
"recommended, and will increase overhead!"
230+
)
232231

233232
true
234233
end
@@ -238,6 +237,10 @@ def self.build_profiler_component(settings:, agent_settings:, optional_tracer:,
238237

239238
return false unless heap_profiling_enabled && heap_size_profiling_enabled
240239

240+
logger.warn(
241+
"Enabled experimental heap size profiling. This is experimental, not recommended, and will increase overhead!"
242+
)
243+
241244
true
242245
end
243246

spec/datadog/profiling/component_spec.rb

+6-10
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,8 @@
331331
settings.profiling.allocation_enabled = false
332332
end
333333

334-
it "initializes StackRecorder without heap sampling support and warns" do
335-
expect(Datadog::Profiling::StackRecorder).to receive(:new)
336-
.with(hash_including(heap_samples_enabled: false, heap_size_enabled: false))
337-
.and_call_original
338-
339-
expect(logger).to receive(:warn).with(/allocation profiling is not enabled/)
340-
341-
build_profiler_component
334+
it "raises an ArgumentError during component initialization" do
335+
expect { build_profiler_component }.to raise_error(ArgumentError, /requires allocation profiling/)
342336
end
343337
end
344338

@@ -356,7 +350,8 @@
356350

357351
expect(logger).to receive(:info).with(/Ractors.+stopping/)
358352
expect(logger).to receive(:debug).with(/Enabled allocation profiling/)
359-
expect(logger).to receive(:debug).with(/Enabled heap profiling/)
353+
expect(logger).to receive(:warn).with(/experimental heap profiling/)
354+
expect(logger).to receive(:warn).with(/experimental heap size profiling/)
360355

361356
build_profiler_component
362357
end
@@ -373,7 +368,8 @@
373368

374369
expect(logger).to receive(:info).with(/Ractors.+stopping/)
375370
expect(logger).to receive(:debug).with(/Enabled allocation profiling/)
376-
expect(logger).to receive(:debug).with(/Enabled heap profiling/)
371+
expect(logger).to receive(:warn).with(/experimental heap profiling/)
372+
expect(logger).not_to receive(:warn).with(/experimental heap size profiling/)
377373

378374
build_profiler_component
379375
end

0 commit comments

Comments
 (0)