Class: NewRelic::Agent::Transaction::DeveloperModeSampleBuffer
- Inherits:
-
TransactionSampleBuffer
- Object
- TransactionSampleBuffer
- NewRelic::Agent::Transaction::DeveloperModeSampleBuffer
- Defined in:
- lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb
Constant Summary collapse
- MAX_SAMPLES =
100
Constants inherited from TransactionSampleBuffer
TransactionSampleBuffer::NO_SAMPLES
Instance Attribute Summary
Attributes inherited from TransactionSampleBuffer
Instance Method Summary collapse
- #enabled? ⇒ Boolean
- #harvest_samples ⇒ Object
- #max_samples ⇒ Object
-
#store_previous ⇒ Object
We don’t hold onto previously trapped transactions on harvest We’ve already got all the traces we want, thank you!.
- #strip_newrelic_frames(trace) ⇒ Object
-
#truncate_samples ⇒ Object
Truncate to the last max_samples we’ve received.
-
#visit_segment(segment) ⇒ Object
Captures the stack trace for a segment This is expensive and not for production mode.
Methods inherited from TransactionSampleBuffer
#allow_sample?, #full?, #initialize, #reset!, #store, #truncate_samples_if_needed
Constructor Details
This class inherits a constructor from NewRelic::Agent::Transaction::TransactionSampleBuffer
Instance Method Details
#enabled? ⇒ Boolean
22 23 24 |
# File 'lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb', line 22 def enabled? Agent.config[:developer_mode] end |
#harvest_samples ⇒ Object
18 19 20 |
# File 'lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb', line 18 def harvest_samples NO_SAMPLES end |
#max_samples ⇒ Object
14 15 16 |
# File 'lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb', line 14 def max_samples MAX_SAMPLES end |
#store_previous ⇒ Object
We don’t hold onto previously trapped transactions on harvest We’ve already got all the traces we want, thank you!
33 34 |
# File 'lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb', line 33 def store_previous(*) end |
#strip_newrelic_frames(trace) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb', line 46 def strip_newrelic_frames(trace) while trace.first =~/\/lib\/new_relic\/agent\// trace.shift end trace end |
#truncate_samples ⇒ Object
Truncate to the last max_samples we’ve received
27 28 29 |
# File 'lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb', line 27 def truncate_samples @samples = @samples.last(max_samples) end |
#visit_segment(segment) ⇒ Object
Captures the stack trace for a segment This is expensive and not for production mode
38 39 40 41 42 43 44 |
# File 'lib/new_relic/agent/transaction/developer_mode_sample_buffer.rb', line 38 def visit_segment(segment) return unless enabled? && segment trace = strip_newrelic_frames(caller) trace = trace.first(40) if trace.length > 40 segment[:backtrace] = trace end |