Sha256: 4cf56d17b4c6d96eacde39dfe651113067c77ce5d2ac939833803142c49217a5

Contents?: true

Size: 971 Bytes

Versions: 3

Compression:

Stored size: 971 Bytes

Contents

# frozen_string_literal: true

# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

require 'opentelemetry'

module OpenTelemetry
  module Instrumentation
    module Rails
      # The Instrumentation class contains logic to detect and install the Rails
      # instrumentation
      class Instrumentation < OpenTelemetry::Instrumentation::Base
        install do |_config|
          require_dependencies
          require_railtie
          patch_metal
        end

        present do
          defined?(::Rails)
        end

        option :enable_recognize_route, default: false, validate: :boolean

        private

        def require_dependencies
          require_relative 'patches/action_controller/metal'
        end

        def require_railtie
          require_relative 'railtie'
        end

        def patch_metal
          ::ActionController::Metal.prepend(Patches::ActionController::Metal)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-rails-0.18.1 lib/opentelemetry/instrumentation/rails/instrumentation.rb
opentelemetry-instrumentation-rails-0.18.0 lib/opentelemetry/instrumentation/rails/instrumentation.rb
opentelemetry-instrumentation-rails-0.17.0 lib/opentelemetry/instrumentation/rails/instrumentation.rb