Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/initializers/prometheus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

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

# Add metric callbacks to all models
ActiveSupport.on_load :active_record do
Expand Down
4 changes: 3 additions & 1 deletion lib/prometheus/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ module Controller

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

register_metrics
Rails.application.executor.wrap do
Expand Down