Module: HoneycombRails::Subscribers::Sampling
- Included in:
- ActiveRecord, ProcessAction
- Defined in:
- lib/honeycomb-rails/subscribers/sampling.rb
Instance Method Summary collapse
Instance Method Details
#sample_event_if_required(honeycomb_event, notification_event) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/honeycomb-rails/subscribers/sampling.rb', line 4 def sample_event_if_required(honeycomb_event, notification_event) case HoneycombRails.config.sample_rate when Proc honeycomb_event.sample_rate = HoneycombRails.config.sample_rate.call( notification_event.name, notification_event.payload, ) when Integer if HoneycombRails.config.sample_rate > 1 honeycomb_event.sample_rate = HoneycombRails.config.sample_rate end end end |