Skip to content

Commit

Permalink
WIP: Possible workaround and more debugging info for loading profiler
Browse files Browse the repository at this point in the history
Issue #1545
  • Loading branch information
ivoanjo committed Jun 7, 2021
1 parent 339c1d2 commit 14efff1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/ddtrace/configuration/components.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ def build_profiler(settings, agent_settings)
return unless Datadog::Profiling.supported? && settings.profiling.enabled

# Load extensions needed to support some of the Profiling features
Datadog.logger.debug("Force triggering load_profiling... loaded_during_initialization: #{Datadog::Profiling.instance_variable_get(:@loaded_during_initialization)}")
Datadog::Profiling.send(:load_profiling)

Datadog::Profiling::Tasks::Setup.new.run

# NOTE: Please update the Initialization section of ProfilingDevelopment.md with any changes to this method
Expand Down
12 changes: 11 additions & 1 deletion lib/ddtrace/profiling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,20 @@ def self.load_profiling

require 'ddtrace/profiling/pprof/pprof_pb'

puts ' [DDTRACE-PROFILER-INIT] Loaded profiler'

true
end
private_class_method :load_profiling

load_profiling if supported?
puts " [DDTRACE-PROFILER-INIT] Attempting to load the profiler, unsupported_reason (if any): #{unsupported_reason.inspect}"
if supported?
load_profiling
@loaded_during_initialization = true
puts ' [DDTRACE-PROFILER-INIT] Loaded during initialization!'
else
@loaded_during_initialization = false
puts ' [DDTRACE-PROFILER-INIT] Not loaded during initialization'
end
end
end

0 comments on commit 14efff1

Please sign in to comment.