Module: NewRelic::Agent::Instrumentation::Redis
- Defined in:
- lib/new_relic/agent/instrumentation/redis/constants.rb,
lib/new_relic/agent/instrumentation/redis/chain.rb,
lib/new_relic/agent/instrumentation/redis/prepend.rb,
lib/new_relic/agent/instrumentation/redis/instrumentation.rb
Overview
This file is distributed under New Relic’s license terms. See github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details. frozen_string_literal: true
Defined Under Namespace
Modules: Chain, Prepend Classes: Constants
Constant Summary collapse
Instance Method Summary collapse
-
#call_pipeline_with_tracing(pipeline) ⇒ Object
Used for Redis 4.x and 3.x.
-
#call_pipelined_with_tracing(pipeline) ⇒ Object
Used for Redis 5.x+.
- #call_with_tracing(command, &block) ⇒ Object
- #connect_with_tracing ⇒ Object
Instance Method Details
#call_pipeline_with_tracing(pipeline) ⇒ Object
Used for Redis 4.x and 3.x
23 24 25 26 27 28 |
# File 'lib/new_relic/agent/instrumentation/redis/instrumentation.rb', line 23 def call_pipeline_with_tracing(pipeline) operation = pipeline.is_a?(::Redis::Pipeline::Multi) ? Constants::MULTI_OPERATION : Constants::PIPELINE_OPERATION statement = ::NewRelic::Agent::Datastores::Redis.format_pipeline_commands(pipeline.commands) with_tracing(operation, statement: statement, database: db) { yield } end |
#call_pipelined_with_tracing(pipeline) ⇒ Object
Used for Redis 5.x+
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/new_relic/agent/instrumentation/redis/instrumentation.rb', line 31 def call_pipelined_with_tracing(pipeline) db = begin _nr_redis_client_config.db rescue StandardError => e NewRelic::Agent.logger.error("Failed to determine configured Redis db value: #{e.class} - #{e.}") nil end operation = pipeline.flatten.include?('MULTI') ? Constants::MULTI_OPERATION : Constants::PIPELINE_OPERATION statement = ::NewRelic::Agent::Datastores::Redis.format_pipeline_commands(pipeline) with_tracing(operation, statement: statement, database: db) { yield } end |
#call_with_tracing(command, &block) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/new_relic/agent/instrumentation/redis/instrumentation.rb', line 15 def call_with_tracing(command, &block) operation = command[0] statement = ::NewRelic::Agent::Datastores::Redis.format_command(command) with_tracing(operation, statement: statement, database: db) { yield } end |