Sha256: 40a6a7bb9317d2e0f91ed6ae3b3ca99b8950abc8a2e7bad201e5c0bd79117ddf

Contents?: true

Size: 895 Bytes

Versions: 6

Compression:

Stored size: 895 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

        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

6 entries across 6 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-rails-0.16.0 lib/opentelemetry/instrumentation/rails/instrumentation.rb
opentelemetry-instrumentation-rails-0.15.0 lib/opentelemetry/instrumentation/rails/instrumentation.rb
opentelemetry-instrumentation-rails-0.14.0 lib/opentelemetry/instrumentation/rails/instrumentation.rb
opentelemetry-instrumentation-rails-0.13.0 lib/opentelemetry/instrumentation/rails/instrumentation.rb
opentelemetry-instrumentation-rails-0.12.0 lib/opentelemetry/instrumentation/rails/instrumentation.rb
opentelemetry-instrumentation-rails-0.11.0 lib/opentelemetry/instrumentation/rails/instrumentation.rb