Sha256: 4088bd0aa6e788667460e1664be69ebd0c1421163e9e76d24f5c678722555f5b

Contents?: true

Size: 1.32 KB

Versions: 20

Compression:

Stored size: 1.32 KB

Contents

# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
# frozen_string_literal: true

require 'new_relic/agent/datastores'
require 'new_relic/agent/datastores/redis'

require_relative 'redis/instrumentation'
require_relative 'redis/chain'
require_relative 'redis/constants'
require_relative 'redis/prepend'
require_relative 'redis/middleware'

DependencyDetection.defer do
  # Why not :redis? newrelic-redis used that name, so avoid conflicting
  @name = :redis_instrumentation
  configure_with :redis

  depends_on do
    defined?(Redis) && defined?(Redis::VERSION)
  end

  conflicts_with_prepend do
    defined?(PrometheusExporter)
  end

  depends_on do
    NewRelic::Agent::Datastores::Redis.is_supported_version? &&
      NewRelic::Agent::Datastores::Redis.safe_from_third_party_gem?
  end

  executes do
    NewRelic::Agent.logger.info('Installing Redis Instrumentation')
    if NewRelic::Agent::Instrumentation::Redis::Constants::HAS_REDIS_CLIENT
      RedisClient.register(NewRelic::Agent::Instrumentation::RedisClient::Middleware)
    end

    if use_prepend?
      prepend_instrument Redis::Client, NewRelic::Agent::Instrumentation::Redis::Prepend
    else
      chain_instrument NewRelic::Agent::Instrumentation::Redis::Chain
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
newrelic_rpm-9.11.0 lib/new_relic/agent/instrumentation/redis.rb
newrelic_rpm-9.10.2 lib/new_relic/agent/instrumentation/redis.rb
newrelic_rpm-9.10.1 lib/new_relic/agent/instrumentation/redis.rb
newrelic_rpm-9.10.0 lib/new_relic/agent/instrumentation/redis.rb
newrelic_rpm-9.9.0 lib/new_relic/agent/instrumentation/redis.rb
newrelic_rpm-9.8.0 lib/new_relic/agent/instrumentation/redis.rb
newrelic_rpm-9.7.1 lib/new_relic/agent/instrumentation/redis.rb
newrelic_rpm-9.7.0 lib/new_relic/agent/instrumentation/redis.rb
newrelic_rpm-9.6.0 lib/new_relic/agent/instrumentation/redis.rb
newrelic_rpm-9.5.0 lib/new_relic/agent/instrumentation/redis.rb
newrelic_rpm-9.4.2 lib/new_relic/agent/instrumentation/redis.rb
newrelic_rpm-9.4.1 lib/new_relic/agent/instrumentation/redis.rb
newrelic_rpm-9.4.0 lib/new_relic/agent/instrumentation/redis.rb
newrelic_rpm-9.3.1 lib/new_relic/agent/instrumentation/redis.rb
newrelic_rpm-9.3.0 lib/new_relic/agent/instrumentation/redis.rb
newrelic_rpm-9.2.2 lib/new_relic/agent/instrumentation/redis.rb
newrelic_rpm-9.2.1 lib/new_relic/agent/instrumentation/redis.rb
newrelic_rpm-9.2.0 lib/new_relic/agent/instrumentation/redis.rb
newrelic_rpm-9.1.0 lib/new_relic/agent/instrumentation/redis.rb
newrelic_rpm-9.0.0 lib/new_relic/agent/instrumentation/redis.rb