Class: OneApm::Collector::Commands::XraySession

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/one_apm/collector/commands/xray_session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command_arguments) ⇒ XraySession

Returns a new instance of XraySession.



15
16
17
18
19
20
21
22
23
24
# File 'lib/one_apm/collector/commands/xray_session.rb', line 15

def initialize(command_arguments)
  @command_arguments     = command_arguments
  @id                    = command_arguments.fetch("x_ray_id", nil)
  @xray_session_name     = command_arguments.fetch("xray_session_name", "")
  @key_transaction_name  = command_arguments.fetch("key_transaction_name", "")
  @requested_trace_count = command_arguments.fetch("requested_trace_count", 100)
  @duration              = command_arguments.fetch("duration", 86400)
  @sample_period         = command_arguments.fetch("sample_period", 0.1)
  @run_profiler          = command_arguments.fetch("run_profiler", true)
end

Instance Attribute Details

#command_argumentsObject (readonly)

Returns the value of attribute command_arguments.



11
12
13
# File 'lib/one_apm/collector/commands/xray_session.rb', line 11

def command_arguments
  @command_arguments
end

#durationObject (readonly)

Returns the value of attribute duration.



12
13
14
# File 'lib/one_apm/collector/commands/xray_session.rb', line 12

def duration
  @duration
end

#idObject (readonly)

Returns the value of attribute id.



11
12
13
# File 'lib/one_apm/collector/commands/xray_session.rb', line 11

def id
  @id
end

#key_transaction_nameObject (readonly)

Returns the value of attribute key_transaction_name.



12
13
14
# File 'lib/one_apm/collector/commands/xray_session.rb', line 12

def key_transaction_name
  @key_transaction_name
end

#requested_trace_countObject (readonly)

Returns the value of attribute requested_trace_count.



12
13
14
# File 'lib/one_apm/collector/commands/xray_session.rb', line 12

def requested_trace_count
  @requested_trace_count
end

#sample_periodObject (readonly)

Returns the value of attribute sample_period.



12
13
14
# File 'lib/one_apm/collector/commands/xray_session.rb', line 12

def sample_period
  @sample_period
end

#xray_session_nameObject (readonly)

Returns the value of attribute xray_session_name.



12
13
14
# File 'lib/one_apm/collector/commands/xray_session.rb', line 12

def xray_session_name
  @xray_session_name
end

Instance Method Details

#activateObject



34
35
36
37
# File 'lib/one_apm/collector/commands/xray_session.rb', line 34

def activate
  @active = true
  @start_time = Time.now
end

#active?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/one_apm/collector/commands/xray_session.rb', line 26

def active?
  @active
end

#deactivateObject



39
40
41
# File 'lib/one_apm/collector/commands/xray_session.rb', line 39

def deactivate
  @active = false
end

#finished?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/one_apm/collector/commands/xray_session.rb', line 47

def finished?
  @start_time + @duration < Time.now
end

#requested_periodObject



43
44
45
# File 'lib/one_apm/collector/commands/xray_session.rb', line 43

def requested_period
  @sample_period
end

#run_profiler?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/one_apm/collector/commands/xray_session.rb', line 30

def run_profiler?
  @run_profiler && OneApm::Manager.config[:'xray_session.allow_profiles']
end