Sha256: 6370ee77ecd10ed813ab6f4cc27b43fa6cebb546ab7cc111ca778c165b1f546f

Contents?: true

Size: 748 Bytes

Versions: 2

Compression:

Stored size: 748 Bytes

Contents

# frozen_string_literal: true

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

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

        present do
          defined?(::Redis)
        end

        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

2 entries across 2 versions & 1 rubygems

Version Path
opentelemetry-adapters-redis-0.4.0 lib/opentelemetry/adapters/redis/adapter.rb
opentelemetry-adapters-redis-0.3.0 lib/opentelemetry/adapters/redis/adapter.rb