-
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.
Implement Mysql2 integration configuration (#559)
* Refactored: Mysql2 to use Datadog::Contrib::Integration. * Fixed: Mysql2 tests not working locally.
- Loading branch information
Showing
8 changed files
with
86 additions
and
30 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
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/mysql2/ext' | ||
|
||
module Datadog | ||
module Contrib | ||
module Mysql2 | ||
module Configuration | ||
# Custom settings for the Mysql2 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,15 @@ | ||
module Datadog | ||
module Contrib | ||
module Mysql2 | ||
# Mysql2 integration constants | ||
module Ext | ||
APP = 'mysql2'.freeze | ||
SERVICE_NAME = 'mysql2'.freeze | ||
|
||
SPAN_QUERY = 'mysql2.query'.freeze | ||
|
||
TAG_DB_NAME = 'mysql2.db.name'.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,32 @@ | ||
require 'ddtrace/contrib/integration' | ||
require 'ddtrace/contrib/mysql2/configuration/settings' | ||
require 'ddtrace/contrib/mysql2/patcher' | ||
|
||
module Datadog | ||
module Contrib | ||
module Mysql2 | ||
# Description of Mysql2 integration | ||
class Integration | ||
include Contrib::Integration | ||
|
||
register_as :mysql2 | ||
|
||
def self.version | ||
Gem.loaded_specs['mysql2'] && Gem.loaded_specs['mysql2'].version | ||
end | ||
|
||
def self.present? | ||
super && defined?(::Mysql2) | ||
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