Sha256: dad87047c5ca092f6e3e6dfd0498a62785152cb996c12ce692462d9f48d22fd9

Contents?: true

Size: 896 Bytes

Versions: 2

Compression:

Stored size: 896 Bytes

Contents

# frozen_string_literal: true

# Copyright 2020 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

        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

2 entries across 2 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-rails-0.10.0 lib/opentelemetry/instrumentation/rails/instrumentation.rb
opentelemetry-instrumentation-rails-0.9.0 lib/opentelemetry/instrumentation/rails/instrumentation.rb