From d9be90a2893cb84aebc8a616f4207c9fe5b13426 Mon Sep 17 00:00:00 2001 From: Maciej Mensfeld Date: Sun, 17 Dec 2023 09:42:27 +0100 Subject: [PATCH] Revert "Explicit modules (#425)" This reverts commit b5b13c21f2086dd5ff240e50d18cf3bc2f525721. --- CHANGELOG.md | 1 - lib/waterdrop/clients.rb | 7 ------- lib/waterdrop/clients/rdkafka.rb | 1 + lib/waterdrop/helpers.rb | 7 ------- lib/waterdrop/helpers/counter.rb | 1 + lib/waterdrop/instrumentation.rb | 7 ------- lib/waterdrop/instrumentation/callbacks.rb | 9 --------- .../instrumentation/callbacks/statistics.rb | 1 + lib/waterdrop/instrumentation/logger_listener.rb | 1 + lib/waterdrop/instrumentation/vendors.rb | 9 --------- lib/waterdrop/instrumentation/vendors/datadog.rb | 11 ----------- .../vendors/datadog/metrics_listener.rb | 2 ++ spec/lib/waterdrop_spec.rb | 13 ------------- 13 files changed, 6 insertions(+), 64 deletions(-) delete mode 100644 lib/waterdrop/clients.rb delete mode 100644 lib/waterdrop/helpers.rb delete mode 100644 lib/waterdrop/instrumentation.rb delete mode 100644 lib/waterdrop/instrumentation/callbacks.rb delete mode 100644 lib/waterdrop/instrumentation/vendors.rb delete mode 100644 lib/waterdrop/instrumentation/vendors/datadog.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 27ec6b4c..4ec1f67d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,6 @@ # WaterDrop changelog ## 2.6.12 (Unreleased) -- [Fix] Use explicit file modules declarations to avoid potential loading errors. - [Change] Remove usage of concurrent ruby. ## 2.6.11 (2023-10-25) diff --git a/lib/waterdrop/clients.rb b/lib/waterdrop/clients.rb deleted file mode 100644 index 49da1a21..00000000 --- a/lib/waterdrop/clients.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -module WaterDrop - # Namespace for all the clients that WaterDrop may use under the hood - module Clients - end -end diff --git a/lib/waterdrop/clients/rdkafka.rb b/lib/waterdrop/clients/rdkafka.rb index dfbe8d2b..c5a73188 100644 --- a/lib/waterdrop/clients/rdkafka.rb +++ b/lib/waterdrop/clients/rdkafka.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true module WaterDrop + # Namespace for all the clients that WaterDrop may use under the hood module Clients # Default Rdkafka client. # Since we use the ::Rdkafka::Producer under the hood, this is just a module that aligns with diff --git a/lib/waterdrop/helpers.rb b/lib/waterdrop/helpers.rb deleted file mode 100644 index 5ac1d64a..00000000 --- a/lib/waterdrop/helpers.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -module WaterDrop - # Extra internal helper objects - module Helpers - end -end diff --git a/lib/waterdrop/helpers/counter.rb b/lib/waterdrop/helpers/counter.rb index 20e17467..a333ede1 100644 --- a/lib/waterdrop/helpers/counter.rb +++ b/lib/waterdrop/helpers/counter.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true module WaterDrop + # Extra internal helper objects module Helpers # Atomic counter that we can safely increment and decrement without race conditions class Counter diff --git a/lib/waterdrop/instrumentation.rb b/lib/waterdrop/instrumentation.rb deleted file mode 100644 index 33c26989..00000000 --- a/lib/waterdrop/instrumentation.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -module WaterDrop - # WaterDrop instrumentation related module - module Instrumentation - end -end diff --git a/lib/waterdrop/instrumentation/callbacks.rb b/lib/waterdrop/instrumentation/callbacks.rb deleted file mode 100644 index 345eb1b3..00000000 --- a/lib/waterdrop/instrumentation/callbacks.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -module WaterDrop - module Instrumentation - # Namespace for handlers of callbacks emitted by the kafka client lib - module Callbacks - end - end -end diff --git a/lib/waterdrop/instrumentation/callbacks/statistics.rb b/lib/waterdrop/instrumentation/callbacks/statistics.rb index 417bc353..9b5dcef5 100644 --- a/lib/waterdrop/instrumentation/callbacks/statistics.rb +++ b/lib/waterdrop/instrumentation/callbacks/statistics.rb @@ -2,6 +2,7 @@ module WaterDrop module Instrumentation + # Namespace for handlers of callbacks emitted by the kafka client lib module Callbacks # Statistics callback handler # @note We decorate the statistics with our own decorator because some of the metrics from diff --git a/lib/waterdrop/instrumentation/logger_listener.rb b/lib/waterdrop/instrumentation/logger_listener.rb index 92d0929c..942a7dff 100644 --- a/lib/waterdrop/instrumentation/logger_listener.rb +++ b/lib/waterdrop/instrumentation/logger_listener.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true module WaterDrop + # WaterDrop instrumentation related module module Instrumentation # Default listener that hooks up to our instrumentation and uses its events for logging # It can be removed/replaced or anything without any harm to the Waterdrop flow diff --git a/lib/waterdrop/instrumentation/vendors.rb b/lib/waterdrop/instrumentation/vendors.rb deleted file mode 100644 index 4e7e9f90..00000000 --- a/lib/waterdrop/instrumentation/vendors.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -module WaterDrop - module Instrumentation - # Namespace for vendor specific instrumentation - module Vendors - end - end -end diff --git a/lib/waterdrop/instrumentation/vendors/datadog.rb b/lib/waterdrop/instrumentation/vendors/datadog.rb deleted file mode 100644 index 61030724..00000000 --- a/lib/waterdrop/instrumentation/vendors/datadog.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -module WaterDrop - module Instrumentation - module Vendors - # Datadog specific instrumentation - module Datadog - end - end - end -end diff --git a/lib/waterdrop/instrumentation/vendors/datadog/metrics_listener.rb b/lib/waterdrop/instrumentation/vendors/datadog/metrics_listener.rb index 1d0f75ac..e36c408d 100644 --- a/lib/waterdrop/instrumentation/vendors/datadog/metrics_listener.rb +++ b/lib/waterdrop/instrumentation/vendors/datadog/metrics_listener.rb @@ -2,7 +2,9 @@ module WaterDrop module Instrumentation + # Namespace for vendor specific instrumentation module Vendors + # Datadog specific instrumentation module Datadog # Listener that can be used to subscribe to WaterDrop producer to receive stats via StatsD # and/or Datadog diff --git a/spec/lib/waterdrop_spec.rb b/spec/lib/waterdrop_spec.rb index 8ebc81a1..98360a29 100644 --- a/spec/lib/waterdrop_spec.rb +++ b/spec/lib/waterdrop_spec.rb @@ -10,17 +10,4 @@ it { expect(waterdrop.gem_root.to_path).to eq path } end end - - describe 'modules files existence' do - let(:lib_location) { File.join(WaterDrop.gem_root, 'lib', 'waterdrop', '**/**') } - let(:candidates) { Dir[lib_location].to_a } - - it do - failed = candidates.select do |path| - File.directory?(path) && !File.exist?("#{path}.rb") - end - - expect(failed).to eq([]) - end - end end