Skip to content

Commit cea4b45

Browse files
MrSerthDome-GER
authored andcommitted
Prevent Prometheus initialization during i18n export
Fixes CODEOCEAN-157
1 parent ddcc0f6 commit cea4b45

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

config/initializers/prometheus.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
return unless CodeOcean::Config.new(:code_ocean).read[:prometheus_exporter][:enabled] && !defined?(Rails::Console)
77
return if %w[db: assets:].any? {|task| Rake.application.top_level_tasks.to_s.include?(task) }
8+
return if %w[i18n].any?(File.basename($PROGRAM_NAME))
89

910
# Add metric callbacks to all models
1011
ActiveSupport.on_load :active_record do

lib/prometheus/controller.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ module Controller
1010

1111
class << self
1212
def initialize_metrics
13-
return unless CodeOcean::Config.new(:code_ocean).read[:prometheus_exporter][:enabled] && defined?(::Rails::Console).blank?
13+
return unless CodeOcean::Config.new(:code_ocean).read[:prometheus_exporter][:enabled] && !defined?(Rails::Console)
14+
return if %w[db: assets:].any? {|task| Rake.application.top_level_tasks.to_s.include?(task) }
15+
return if %w[i18n].any?(File.basename($PROGRAM_NAME))
1416

1517
register_metrics
1618
Rails.application.executor.wrap do

0 commit comments

Comments
 (0)