Skip to content

Commit

Permalink
DEBUG-3328 log probe installation and DI payload submission to agent …
Browse files Browse the repository at this point in the history
…for debugging
  • Loading branch information
p committed Jan 16, 2025
1 parent 3d54001 commit baa571f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/datadog/di.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ def component
#
# If DI is enabled programmatically, the application can (and must,
# for line probes to work) activate tracking in an initializer.
if %w'1 true debug'.include?(ENV['DD_TRACE_DEBUG'])
# We seem to have Datadog.logger here already
Datadog.logger.debug("di: activating code tracking")
end
Datadog::DI.activate_tracking
end

Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/di/contrib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module DI
module Contrib
module_function def load_now_or_later
if Datadog::Core::Contrib::Rails::Utils.railtie_supported?
Datadog.logger.debug('di: loading contrib/railtie')
require_relative 'contrib/railtie'
else
load_now
Expand All @@ -18,6 +19,7 @@ module Contrib
# dependencies are loaded (or potentially loaded).
module_function def load_now
if defined?(ActiveRecord::Base)
Datadog.logger.debug('di: loading contrib/active_record')
require_relative 'contrib/active_record'
end
end
Expand Down
2 changes: 2 additions & 0 deletions lib/datadog/di/probe_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,11 @@ def add_probe(probe)
# Always remove from pending list here because it makes the
# API smaller and shouldn't cause any actual problems.
@pending_probes.delete(probe.id)
logger.debug { "di: installed #{probe.type} probe #{probe.id}" }
true
rescue Error::DITargetNotDefined
@pending_probes[probe.id] = probe
logger.debug { "di: could not install #{probe.type} probe #{probe.id} because its target is not defined, adding it to pending list" }
false
end
rescue => exc
Expand Down
1 change: 1 addition & 0 deletions lib/datadog/di/probe_notifier_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ def set_sleep_remaining
end
if batch.any? # steep:ignore
begin
logger.debug { "di: sending #{batch.length} #{event_type} payloads to agent" }
transport.public_send("send_#{event_type}", batch)
time = Core::Utils::Time.get_time
@lock.synchronize do
Expand Down

0 comments on commit baa571f

Please sign in to comment.