From a39c4c1e4cecbf2aa8698e4f0fe7d46781e00e02 Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Thu, 10 Nov 2022 13:08:00 +0100 Subject: [PATCH] Fix rubocop --- lib/datadog/tracing/contrib/redis/instrumentation.rb | 6 ++++-- lib/datadog/tracing/contrib/redis/patcher.rb | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/datadog/tracing/contrib/redis/instrumentation.rb b/lib/datadog/tracing/contrib/redis/instrumentation.rb index 20f3bbd195..ac8ed12228 100644 --- a/lib/datadog/tracing/contrib/redis/instrumentation.rb +++ b/lib/datadog/tracing/contrib/redis/instrumentation.rb @@ -21,7 +21,8 @@ module InstanceMethods def call(*args, &block) response = nil Tracing.trace(Contrib::Redis::Ext::SPAN_COMMAND) do |span| - span.service = Datadog.configuration_for(redis_instance, :service_name) || datadog_configuration[:service_name] + span.service = Datadog.configuration_for(redis_instance, :service_name) || + datadog_configuration[:service_name] span.span_type = Contrib::Redis::Ext::TYPE span.resource = get_command(args) Contrib::Redis::Tags.set_common_tags(self, span) @@ -35,7 +36,8 @@ def call(*args, &block) def call_pipeline(*args, &block) response = nil Tracing.trace(Contrib::Redis::Ext::SPAN_COMMAND) do |span| - span.service = Datadog.configuration_for(redis_instance, :service_name) || datadog_configuration[:service_name] + span.service = Datadog.configuration_for(redis_instance, :service_name) || + datadog_configuration[:service_name] span.span_type = Contrib::Redis::Ext::TYPE commands = get_pipeline_commands(args) span.resource = commands.any? ? commands.join("\n") : '(none)' diff --git a/lib/datadog/tracing/contrib/redis/patcher.rb b/lib/datadog/tracing/contrib/redis/patcher.rb index 437544b104..1cee1cdb8a 100644 --- a/lib/datadog/tracing/contrib/redis/patcher.rb +++ b/lib/datadog/tracing/contrib/redis/patcher.rb @@ -12,11 +12,13 @@ module Redis module Patcher include Contrib::Patcher + # Patch for redis instance module InstancePatch def self.included(base) base.prepend(InstanceMethods) end + # Instance method patch for redis instance module InstanceMethods def initialize(options = {}) options[:redis_instance] = self @@ -26,11 +28,13 @@ def initialize(options = {}) end end + # Patch for redis client module ClientPatch def self.included(base) base.prepend(InstanceMethods) end + # Instance method patch for redis client module InstanceMethods def initialize(options = {}) @redis_instance = options[:redis_instance]