Sha256: 141ad0c31518cb5f8aefb7dd868413d13890e682c58fb7380f732db35558599c
Contents?: true
Size: 1.32 KB
Versions: 18
Compression:
Stored size: 1.32 KB
Contents
# encoding: utf-8 require 'one_apm/transaction/sample_buffer/transaction_sample_buffer' module OneApm class Transaction class DeveloperModeSampleBuffer < TransactionSampleBuffer CAPACITY = 100 def capacity max_capacity end # Dev mode is allowed more than the typical upper limit. # Sidestep normal cap by overriding max_capacity. def max_capacity CAPACITY end def harvest_samples NO_SAMPLES end def enabled? Manager.config[:developer_mode] end # Truncate to the last capacity samples we've received def truncate_samples @samples = @samples.last(capacity) end # We don't hold onto previously trapped transactions on harvest # We've already got all the traces we want, thank you! def store_previous(*) end # Captures the stack trace for a segment # This is expensive and not for production mode def visit_segment(segment) return unless enabled? && segment trace = strip_oneapm_frames(caller) trace = trace.first(40) if trace.length > 40 segment[:backtrace] = trace end def strip_oneapm_frames(trace) while trace.first =~ /lib\/one_apm/ trace.shift end trace end end end end
Version data entries
18 entries across 18 versions & 1 rubygems