Module: AgentHooks

Included in:
Instana::Agent
Defined in:
lib/instana/agent/hooks.rb

Instance Method Summary collapse

Instance Method Details

#after_forkObject

Used post fork to re-initialize state and restart communications with the host agent.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/instana/agent/hooks.rb', line 5

def after_fork
  ::Instana.logger.debug "after_fork hook called. Falling back to unannounced state and spawning a new background agent thread."

  @timers.cancel

  # Reseed the random number generator for this
  # new thread.
  srand

  transition_to(:unannounced)

  setup
  spawn_background_thread
end

#after_resque_forkObject



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

def after_resque_fork
  ::Instana.logger.debug "after_resque_fork hook called. pid/ppid: #{Process.pid}/#{Process.ppid}"

  @timers.cancel

  # Reseed the random number generator for this
  # new thread.
  srand

  ::Instana.config[:metrics][:enabled] = false

  @process[:pid] = Process.pid

  setup
  spawn_background_thread
end

#before_resque_forkObject



20
21
22
23
# File 'lib/instana/agent/hooks.rb', line 20

def before_resque_fork
  ::Instana.logger.debug "before_resque_fork hook called. pid/ppid: #{Process.pid}/#{Process.ppid}"
  @is_resque_worker = true
end