From 6414812b435989b956c0d677777d82356ea217e0 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Mon, 31 Mar 2025 05:41:51 -0400 Subject: [PATCH 1/2] Fix method override warning in profiler --- lib/datadog/profiling.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/datadog/profiling.rb b/lib/datadog/profiling.rb index 114e781030f..c107dc3dfe6 100644 --- a/lib/datadog/profiling.rb +++ b/lib/datadog/profiling.rb @@ -78,8 +78,11 @@ def self.wait_until_running(timeout_seconds: 5) end private_class_method def self.replace_noop_allocation_count - def self.allocation_count # rubocop:disable Lint/NestedMethodDefinition (On purpose!) - Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_allocation_count + class << self + remove_method :allocation_count + def allocation_count # rubocop:disable Lint/NestedMethodDefinition (On purpose!) + Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_allocation_count + end end end From d9d6e4a49356a0e4aa3da7bfcdc0ef73f48d5f85 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Mon, 31 Mar 2025 06:50:50 -0400 Subject: [PATCH 2/2] rubocop, this method is still defined nestedly --- lib/datadog/profiling.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/datadog/profiling.rb b/lib/datadog/profiling.rb index c107dc3dfe6..85c1b5fb480 100644 --- a/lib/datadog/profiling.rb +++ b/lib/datadog/profiling.rb @@ -80,7 +80,7 @@ def self.wait_until_running(timeout_seconds: 5) private_class_method def self.replace_noop_allocation_count class << self remove_method :allocation_count - def allocation_count # rubocop:disable Lint/NestedMethodDefinition (On purpose!) + def allocation_count Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_allocation_count end end