Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DI progress logs #4283

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment on lines +61 to +64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure the DD_TRACE_DEBUG check is needed -- the logger initialization is already supposed to be looking at this setting? https://github.com/DataDog/dd-trace-rb/blob/master/lib/datadog/core/configuration.rb#L279 and https://github.com/DataDog/dd-trace-rb/blob/master/lib/datadog/core/configuration/components.rb#L37 should take care of it.

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
Loading