From 91fb59e141d2484a60be88a2ef7b45a760291b08 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sun, 7 Jul 2024 01:27:49 -0400 Subject: [PATCH] di cleanup --- lib/datadog/di/component.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/datadog/di/component.rb b/lib/datadog/di/component.rb index a1f30195bf3..203046f86f6 100644 --- a/lib/datadog/di/component.rb +++ b/lib/datadog/di/component.rb @@ -39,7 +39,17 @@ def initialize(settings, agent_settings) attr_reader :probe_notifier_worker attr_reader :remote_processor + # Shuts down dynamic instrumentation. + # + # Removes all code hooks and stops background threads. + # + # Does not clear out the code tracker, because it's only populated + # by code when code is compiled and therefore, if the code tracker + # was replaced by a new instance, the new instance of it wouldn't have + # any of the already loaded code tracked. def shutdown!(replacement = nil) + hook_manager.clear_hooks + probe_notifier_worker.stop end end end