Class: Datadog::Profiler

Inherits:
Object
  • Object
show all
Defined in:
lib/ddtrace/profiling/profiler.rb

Overview

Profiling entry point, which coordinates collectors and a scheduler

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(collectors, scheduler) ⇒ Profiler

Returns a new instance of Profiler.



9
10
11
12
# File 'lib/ddtrace/profiling/profiler.rb', line 9

def initialize(collectors, scheduler)
  @collectors = collectors
  @scheduler = scheduler
end

Instance Attribute Details

#collectorsObject (readonly)

Returns the value of attribute collectors.



5
6
7
# File 'lib/ddtrace/profiling/profiler.rb', line 5

def collectors
  @collectors
end

#schedulerObject (readonly)

Returns the value of attribute scheduler.



5
6
7
# File 'lib/ddtrace/profiling/profiler.rb', line 5

def scheduler
  @scheduler
end

Instance Method Details

#shutdown!Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ddtrace/profiling/profiler.rb', line 19

def shutdown!
  Datadog.logger.debug('Shutting down profiler')

  collectors.each do |collector|
    collector.enabled = false
    collector.stop(true)
  end

  scheduler.enabled = false
  scheduler.stop(true)
end

#startObject



14
15
16
17
# File 'lib/ddtrace/profiling/profiler.rb', line 14

def start
  collectors.each(&:start)
  scheduler.start
end