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.12.0 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.11.2 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.11.1 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.11.0 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.10.0 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.9.2 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.9.1 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.9.0 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.8.2 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.8.1 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.8.0 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.7.0 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.6.0 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.5.0 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.4.0 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.3.0 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.2.0 lib/govuk_app_config/govuk_open_telemetry.rb
govuk_app_config-9.1.0 lib/govuk_app_config/govuk_open_telemetry.rb