-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored: Redis to use Datadog::Contrib::Integration.
- Loading branch information
Showing
8 changed files
with
96 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require 'ddtrace/contrib/configuration/settings' | ||
require 'ddtrace/contrib/redis/ext' | ||
|
||
module Datadog | ||
module Contrib | ||
module Redis | ||
module Configuration | ||
# Custom settings for the Redis integration | ||
class Settings < Contrib::Configuration::Settings | ||
option :service_name, default: Ext::SERVICE_NAME | ||
option :tracer, default: Datadog.tracer | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module Datadog | ||
module Contrib | ||
module Redis | ||
# Redis integration constants | ||
module Ext | ||
APP = 'redis'.freeze | ||
SERVICE_NAME = 'redis'.freeze | ||
TYPE = 'redis'.freeze | ||
|
||
METRIC_PIPELINE_LEN = 'redis.pipeline_length'.freeze | ||
|
||
SPAN_COMMAND = 'redis.command'.freeze | ||
|
||
TAG_DB = 'out.redis_db'.freeze | ||
TAG_RAW_COMMAND = 'redis.raw_command'.freeze | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require 'ddtrace/contrib/integration' | ||
require 'ddtrace/contrib/redis/configuration/settings' | ||
require 'ddtrace/contrib/redis/patcher' | ||
|
||
module Datadog | ||
module Contrib | ||
module Redis | ||
# Description of Redis integration | ||
class Integration | ||
include Contrib::Integration | ||
|
||
register_as :redis, auto_patch: true | ||
|
||
def self.version | ||
Gem.loaded_specs['redis'] && Gem.loaded_specs['redis'].version | ||
end | ||
|
||
def self.present? | ||
super && defined?(::Redis) | ||
end | ||
|
||
def self.compatible? | ||
!version.nil? && version >= Gem::Version.new('3.0.0') | ||
end | ||
|
||
def default_configuration | ||
Configuration::Settings.new | ||
end | ||
|
||
def patcher | ||
Patcher | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.