Sha256: 95e30f0b92b88f1849919925b24cc13165275860c3f7d3827e6f35274c0ee5ca

Contents?: true

Size: 1.07 KB

Versions: 14

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

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

require 'opentelemetry-instrumentation-base'

module OpenTelemetry
  module Instrumentation
    module Bunny
      # The Instrumentation class contains logic to detect and install the
      # bunny instrumentation
      class Instrumentation < OpenTelemetry::Instrumentation::Base
        install do |_config|
          require_patches
          patch
        end

        present do
          defined?(::Bunny)
        end

        private

        def require_patches
          require_relative 'patch_helpers'
          require_relative 'patches/channel'
          require_relative 'patches/consumer'
          require_relative 'patches/queue'
          require_relative 'patches/reader_loop'
        end

        def patch
          ::Bunny::Channel.prepend(Patches::Channel)
          ::Bunny::Consumer.prepend(Patches::Consumer)
          ::Bunny::Queue.prepend(Patches::Queue)
          ::Bunny::ReaderLoop.prepend(Patches::ReaderLoop)
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-bunny-0.21.4 lib/opentelemetry/instrumentation/bunny/instrumentation.rb
opentelemetry-instrumentation-bunny-0.21.3 lib/opentelemetry/instrumentation/bunny/instrumentation.rb
opentelemetry-instrumentation-bunny-0.21.2 lib/opentelemetry/instrumentation/bunny/instrumentation.rb
opentelemetry-instrumentation-bunny-0.21.1 lib/opentelemetry/instrumentation/bunny/instrumentation.rb
opentelemetry-instrumentation-bunny-0.21.0 lib/opentelemetry/instrumentation/bunny/instrumentation.rb
opentelemetry-instrumentation-bunny-0.20.1 lib/opentelemetry/instrumentation/bunny/instrumentation.rb
opentelemetry-instrumentation-bunny-0.20.0 lib/opentelemetry/instrumentation/bunny/instrumentation.rb
opentelemetry-instrumentation-bunny-0.19.1 lib/opentelemetry/instrumentation/bunny/instrumentation.rb
opentelemetry-instrumentation-bunny-0.19.0 lib/opentelemetry/instrumentation/bunny/instrumentation.rb
opentelemetry-instrumentation-bunny-0.18.5 lib/opentelemetry/instrumentation/bunny/instrumentation.rb
opentelemetry-instrumentation-bunny-0.18.4 lib/opentelemetry/instrumentation/bunny/instrumentation.rb
opentelemetry-instrumentation-bunny-0.18.3 lib/opentelemetry/instrumentation/bunny/instrumentation.rb
opentelemetry-instrumentation-bunny-0.18.2 lib/opentelemetry/instrumentation/bunny/instrumentation.rb
opentelemetry-instrumentation-bunny-0.18.1 lib/opentelemetry/instrumentation/bunny/instrumentation.rb