Class: PlainApm::Agent

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/plain_apm/agent.rb

Instance Method Summary collapse

Instance Method Details

#collect(event) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/plain_apm/agent.rb', line 13

def collect(event)
  return unless enabled?

  # stop accepting events when shutting down / shutdown.
  return if @status != :running

  publisher_start if @pid != $$

  @events << event
end

#enabled?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/plain_apm/agent.rb', line 9

def enabled?
  @config && @config.enabled
end

#startObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/plain_apm/agent.rb', line 24

def start
  if !defined?(@started)
    @started = true
  else
    return
  end

  configure

  return unless enabled?

  warn("PlainAPM agent enabled.")

  setup_at_exit_hooks
  publisher_start
  install_hooks
end