-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored: Rake to use Datadog::Contrib::Integration. (#554)
- Loading branch information
Showing
7 changed files
with
130 additions
and
67 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require 'ddtrace/contrib/configuration/settings' | ||
require 'ddtrace/contrib/rake/ext' | ||
|
||
module Datadog | ||
module Contrib | ||
module Rake | ||
module Configuration | ||
# Custom settings for the Rake integration | ||
class Settings < Contrib::Configuration::Settings | ||
option :service_name, default: Ext::SERVICE_NAME | ||
option :tracer, default: Datadog.tracer | ||
option :enabled, default: true | ||
option :quantize, default: {} | ||
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,18 @@ | ||
module Datadog | ||
module Contrib | ||
module Rake | ||
# Rake integration constants | ||
module Ext | ||
APP = 'rake'.freeze | ||
SERVICE_NAME = 'rake'.freeze | ||
|
||
SPAN_INVOKE = 'rake.invoke'.freeze | ||
SPAN_EXECUTE = 'rake.execute'.freeze | ||
|
||
TAG_EXECUTE_ARGS = 'rake.execute.args'.freeze | ||
TAG_INVOKE_ARGS = 'rake.invoke.args'.freeze | ||
TAG_TASK_ARG_NAMES = 'rake.task.arg_names'.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
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/rake/configuration/settings' | ||
require 'ddtrace/contrib/rake/patcher' | ||
|
||
module Datadog | ||
module Contrib | ||
module Rake | ||
# Description of Rake integration | ||
class Integration | ||
include Contrib::Integration | ||
|
||
register_as :rake | ||
|
||
def self.version | ||
Gem.loaded_specs['rake'] && Gem.loaded_specs['rake'].version | ||
end | ||
|
||
def self.present? | ||
super && defined?(::Rake) | ||
end | ||
|
||
def self.compatible? | ||
super && RUBY_VERSION >= '2.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