-
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: Racecar to use Datadog::Contrib::Integration. (#548)
- Loading branch information
Showing
9 changed files
with
118 additions
and
54 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,23 @@ | ||
require 'ddtrace/contrib/configuration/settings' | ||
require 'ddtrace/contrib/racecar/ext' | ||
|
||
module Datadog | ||
module Contrib | ||
module Racecar | ||
module Configuration | ||
# Custom settings for the Rack integration | ||
class Settings < Contrib::Configuration::Settings | ||
option :service_name, default: Ext::SERVICE_NAME | ||
option :tracer, default: Datadog.tracer do |value| | ||
(value || Datadog.tracer).tap do |v| | ||
# Make sure to update tracers of all subscriptions | ||
Events.subscriptions.each do |subscription| | ||
subscription.tracer = v | ||
end | ||
end | ||
end | ||
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 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,21 @@ | ||
module Datadog | ||
module Contrib | ||
module Racecar | ||
# Racecar integration constants | ||
module Ext | ||
APP = 'racecar'.freeze | ||
SERVICE_NAME = 'racecar'.freeze | ||
|
||
SPAN_BATCH = 'racecar.batch'.freeze | ||
SPAN_MESSAGE = 'racecar.message'.freeze | ||
|
||
TAG_CONSUMER = 'kafka.consumer'.freeze | ||
TAG_FIRST_OFFSET = 'kafka.first_offset'.freeze | ||
TAG_MESSAGE_COUNT = 'kafka.message_count'.freeze | ||
TAG_OFFSET = 'kafka.offset'.freeze | ||
TAG_PARTITION = 'kafka.partition'.freeze | ||
TAG_TOPIC = 'kafka.topic'.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/racecar/configuration/settings' | ||
require 'ddtrace/contrib/racecar/patcher' | ||
|
||
module Datadog | ||
module Contrib | ||
module Racecar | ||
# Description of Racecar integration | ||
class Integration | ||
include Contrib::Integration | ||
|
||
register_as :racecar, auto_patch: false | ||
|
||
def self.version | ||
Gem.loaded_specs['racecar'] && Gem.loaded_specs['racecar'].version | ||
end | ||
|
||
def self.present? | ||
super && defined?(::Racecar) | ||
end | ||
|
||
def self.compatible? | ||
super && defined?(::ActiveSupport::Notifications) | ||
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