Module: GovukOpenTelemetry
- Defined in:
- lib/govuk_app_config/govuk_open_telemetry.rb
Class Method Summary collapse
Class Method Details
.configure(service_name) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/govuk_app_config/govuk_open_telemetry.rb', line 6 def self.configure(service_name) return unless should_configure? require "opentelemetry/sdk" require "opentelemetry/exporter/otlp" require "opentelemetry/instrumentation/all" 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 |
.in_rake_task? ⇒ Boolean
20 21 22 |
# File 'lib/govuk_app_config/govuk_open_telemetry.rb', line 20 def self.in_rake_task? Rails.const_defined?(:Rake) && Rake.application.top_level_tasks.any? end |
.should_configure? ⇒ Boolean
2 3 4 |
# File 'lib/govuk_app_config/govuk_open_telemetry.rb', line 2 def self.should_configure? ENV["ENABLE_OPEN_TELEMETRY"] == "true" end |