Class: SolidApm::Sampler
- Inherits:
-
Object
- Object
- SolidApm::Sampler
- Defined in:
- lib/solid_apm/sampler.rb
Class Method Summary collapse
Class Method Details
.should_sample? ⇒ Boolean
3 4 5 6 7 8 9 10 |
# File 'lib/solid_apm/sampler.rb', line 3 def self.should_sample? return true if SolidApm.transaction_sampling <= 1 thread_counter = Thread.current[:solid_apm_counter] ||= 0 Thread.current[:solid_apm_counter] = (thread_counter + 1) % SolidApm.transaction_sampling Thread.current[:solid_apm_counter] == 0 end |