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
# 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."

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

  transition_to(:unannounced)

  setup
  spawn_background_thread
end

#after_resque_forkObject



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

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

  # 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



18
19
20
21
# File 'lib/instana/agent/hooks.rb', line 18

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