Class: SolidObserver::Services::RecordEvent
- Inherits:
-
Object
- Object
- SolidObserver::Services::RecordEvent
- Defined in:
- lib/solid_observer/services/record_event.rb
Overview
Records ActiveJob events to the buffer with sampling support.
Extracts job metadata, applies sampling rate, and pushes events to the buffer for batch insertion.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(event, event_type, buffer, metric_name) ⇒ RecordEvent
constructor
A new instance of RecordEvent.
Constructor Details
#initialize(event, event_type, buffer, metric_name) ⇒ RecordEvent
Returns a new instance of RecordEvent.
27 28 29 30 31 32 |
# File 'lib/solid_observer/services/record_event.rb', line 27 def initialize(event, event_type, buffer, metric_name) @event = event @event_type = event_type @buffer = buffer @metric_name = metric_name end |
Class Method Details
.call(event:, event_type:, buffer:, metric_name:) ⇒ void
This method returns an undefined value.
23 24 25 |
# File 'lib/solid_observer/services/record_event.rb', line 23 def self.call(event:, event_type:, buffer:, metric_name:) new(event, event_type, buffer, metric_name).call end |
Instance Method Details
#call ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/solid_observer/services/record_event.rb', line 34 def call return unless should_record? @buffer.push(build_event_data) increment_metric rescue => e handle_error(e) end |