diff --git a/lib/gitlab/usage_data_counters/hll_redis_counter.rb b/lib/gitlab/usage_data_counters/hll_redis_counter.rb
index be04e324f79d43763b83b1ae5b1d49f77faf7e0b..0adbd68066897214ae2ee45a16442cdf2f940aa1 100644
--- a/lib/gitlab/usage_data_counters/hll_redis_counter.rb
+++ b/lib/gitlab/usage_data_counters/hll_redis_counter.rb
@@ -15,9 +15,9 @@ module HLLRedisCounter
       CategoryMismatch = Class.new(EventError)
       UnknownAggregationOperator = Class.new(EventError)
 
-      KNOWN_EVENTS_PATH = 'lib/gitlab/usage_data_counters/known_events/*.yml'
+      KNOWN_EVENTS_PATH = File.expand_path('known_events/*.yml', __dir__)
       ALLOWED_AGGREGATIONS = %i(daily weekly).freeze
-      AGGREGATED_METRICS_PATH = 'lib/gitlab/usage_data_counters/aggregated_metrics/*.yml'
+      AGGREGATED_METRICS_PATH = File.expand_path('aggregated_metrics/*.yml', __dir__)
       ALLOWED_METRICS_AGGREGATIONS = %w[ANY].freeze
 
       # Track event on entity_id
@@ -156,7 +156,7 @@ def load_events(wildcard)
         end
 
         def load_yaml_from_path(path)
-          YAML.safe_load(File.read(Rails.root.join(path)))&.map(&:with_indifferent_access)
+          YAML.safe_load(File.read(path))&.map(&:with_indifferent_access)
         end
 
         def known_events_names