Class: OneApm::Transaction::XraySampleBuffer

Inherits:
TransactionSampleBuffer show all
Defined in:
lib/one_apm/transaction/sample_buffer/xray_sample_buffer.rb

Constant Summary

Constants inherited from TransactionSampleBuffer

TransactionSampleBuffer::OA_NO_SAMPLES, TransactionSampleBuffer::OA_SINGLE_BUFFER_MAX

Instance Attribute Summary collapse

Attributes inherited from TransactionSampleBuffer

#samples

Instance Method Summary collapse

Methods inherited from TransactionSampleBuffer

#full?, #harvest_samples, #max_capacity, #reset!, #store, #store_previous, #truncate_samples_if_needed, #visit_segment

Constructor Details

#initializeXraySampleBuffer

Returns a new instance of XraySampleBuffer.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/one_apm/transaction/sample_buffer/xray_sample_buffer.rb', line 11

def initialize
  super

  # Memoize the config setting since this happens per request
  @enabled = OneApm::Manager.config[:'xray_session.allow_traces']
  OneApm::Manager.config.register_callback(:'xray_session.allow_traces') do |new_value|
    @enabled = new_value
  end

  @capacity = OneApm::Manager.config[:'xray_session.max_samples']
  OneApm::Manager.config.register_callback(:'xray_session.max_samples') do |new_value|
    @capacity = new_value
  end
end

Instance Attribute Details

#xray_session_collectionObject



26
27
28
# File 'lib/one_apm/transaction/sample_buffer/xray_sample_buffer.rb', line 26

def xray_session_collection
  @xray_session_collection ||= OneApm::Manager.agent.agent_command_router.xray_session_collection
end

Instance Method Details

#allow_sample?(sample) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/one_apm/transaction/sample_buffer/xray_sample_buffer.rb', line 38

def allow_sample?(sample)
  !full? && !lookup_session_id(sample).nil?
end

#capacityObject



30
31
32
# File 'lib/one_apm/transaction/sample_buffer/xray_sample_buffer.rb', line 30

def capacity
  @capacity
end

#enabled?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/one_apm/transaction/sample_buffer/xray_sample_buffer.rb', line 42

def enabled?
  @enabled
end

#truncate_samplesObject



34
35
36
# File 'lib/one_apm/transaction/sample_buffer/xray_sample_buffer.rb', line 34

def truncate_samples
  # First in wins, so stop on allow_sample? instead of truncating
end