diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ec1f67d..27ec6b4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # 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 new file mode 100644 index 00000000..49da1a21 --- /dev/null +++ b/lib/waterdrop/clients.rb @@ -0,0 +1,7 @@ +# 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 c5a73188..dfbe8d2b 100644 --- a/lib/waterdrop/clients/rdkafka.rb +++ b/lib/waterdrop/clients/rdkafka.rb @@ -1,7 +1,6 @@ # 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 new file mode 100644 index 00000000..5ac1d64a --- /dev/null +++ b/lib/waterdrop/helpers.rb @@ -0,0 +1,7 @@ +# 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 a333ede1..20e17467 100644 --- a/lib/waterdrop/helpers/counter.rb +++ b/lib/waterdrop/helpers/counter.rb @@ -1,7 +1,6 @@ # 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 new file mode 100644 index 00000000..33c26989 --- /dev/null +++ b/lib/waterdrop/instrumentation.rb @@ -0,0 +1,7 @@ +# 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 new file mode 100644 index 00000000..345eb1b3 --- /dev/null +++ b/lib/waterdrop/instrumentation/callbacks.rb @@ -0,0 +1,9 @@ +# 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 9b5dcef5..417bc353 100644 --- a/lib/waterdrop/instrumentation/callbacks/statistics.rb +++ b/lib/waterdrop/instrumentation/callbacks/statistics.rb @@ -2,7 +2,6 @@ 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 942a7dff..92d0929c 100644 --- a/lib/waterdrop/instrumentation/logger_listener.rb +++ b/lib/waterdrop/instrumentation/logger_listener.rb @@ -1,7 +1,6 @@ # 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 new file mode 100644 index 00000000..4e7e9f90 --- /dev/null +++ b/lib/waterdrop/instrumentation/vendors.rb @@ -0,0 +1,9 @@ +# 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 new file mode 100644 index 00000000..61030724 --- /dev/null +++ b/lib/waterdrop/instrumentation/vendors/datadog.rb @@ -0,0 +1,11 @@ +# 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 e36c408d..1d0f75ac 100644 --- a/lib/waterdrop/instrumentation/vendors/datadog/metrics_listener.rb +++ b/lib/waterdrop/instrumentation/vendors/datadog/metrics_listener.rb @@ -2,9 +2,7 @@ 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 98360a29..8ebc81a1 100644 --- a/spec/lib/waterdrop_spec.rb +++ b/spec/lib/waterdrop_spec.rb @@ -10,4 +10,17 @@ 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