Sha256: 5c03b79d5e3771a8d199d33f2d9bdc7b5fa8466340b12620e9988be7ddde08ef

Contents?: true

Size: 822 Bytes

Versions: 3

Compression:

Stored size: 822 Bytes

Contents

# frozen_string_literal: true

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

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

        present do
          defined?(::Redis)
        end

        option :peer_service, default: nil, validate: :string

        private

        def require_dependencies
          require_relative 'utils'
          require_relative 'patches/client'
        end

        def patch_client
          ::Redis::Client.prepend(Patches::Client)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-redis-0.17.0 lib/opentelemetry/instrumentation/redis/instrumentation.rb
opentelemetry-instrumentation-redis-0.16.0 lib/opentelemetry/instrumentation/redis/instrumentation.rb
opentelemetry-instrumentation-redis-0.15.0 lib/opentelemetry/instrumentation/redis/instrumentation.rb