Sha256: 0d44e51bb574d5af464b5bdec751600e13e3a802fc78065b01bf99959dc2ece2

Contents?: true

Size: 623 Bytes

Versions: 38

Compression:

Stored size: 623 Bytes

Contents

module GovukOpenTelemetry
  def self.should_configure?
    ENV["ENABLE_OPEN_TELEMETRY"] == "true"
  end

  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

  def self.in_rake_task?
    Rails.const_defined?(:Rake) && Rake.application.top_level_tasks.any?
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
govuk_app_config-9.16.1 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.16.0 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.15.8 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.15.7 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.15.6 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.15.5 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.15.4 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.15.3 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.15.2 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.15.1 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.15.0 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.14.6 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.14.5 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.14.4 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.14.3 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.14.2 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.14.1 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.14.0 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.13.1 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.13.0 lib/govuk_app_config/govuk_open_telemetry.rb