Skip to content

Commit

Permalink
Move where config takes place
Browse files Browse the repository at this point in the history
  • Loading branch information
KludgeKML committed Aug 17, 2023
1 parent 898b207 commit c2a1768
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 5 additions & 0 deletions lib/govuk_app_config/govuk_open_telemetry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ def self.configure(service_name)
OpenTelemetry::SDK.configure do |config|
config.service_name = service_name
config.use_all # enables all instrumentation!
config.logger = Logger.new(File::NULL) if in_rake_task?
end
end

def self.in_rake_task?
Rails.const_defined?(:Rake) && Rake.application.top_level_tasks.any?
end
end
5 changes: 0 additions & 5 deletions lib/govuk_app_config/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ class Railtie < Rails::Railtie
initializer "govuk_app_config.configure_open_telemetry" do |app|
unless Rails.const_defined?(:Console)
GovukOpenTelemetry.configure(app.class.module_parent_name.underscore)
if Rails.const_defined?(:Rake) && Rake.application.top_level_tasks.any?
OpenTelemetry::SDK.configure do |c|
c.logger = Logger.new(File::NULL)
end
end
end
end

Expand Down

0 comments on commit c2a1768

Please sign in to comment.