Sha256: 30ea0eac6ca32d44e7fe8d6eea6e352a023ba416c060ad1f72835f27373b5d82

Contents?: true

Size: 967 Bytes

Versions: 2

Compression:

Stored size: 967 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
        option :trace_root_spans,             default: true,  validate: :boolean
        option :enable_statement_obfuscation, default: true,  validate: :boolean

        private

        def require_dependencies
          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-instrumentation-redis-0.20.0 lib/opentelemetry/instrumentation/redis/instrumentation.rb
opentelemetry-instrumentation-redis-0.19.0 lib/opentelemetry/instrumentation/redis/instrumentation.rb