Module: LogBrew::Rails::ActiveJobExtension
- Defined in:
- lib/logbrew/rails_integration.rb
Overview
Adapter-neutral ActiveJob tracing installed through the Rails lazy-load hook.
Instance Method Summary collapse
- #_perform_job ⇒ Object
- #deserialize(payload) ⇒ Object
- #enqueue(options = {}) ⇒ Object
- #perform_now ⇒ Object
- #serialize ⇒ Object
Instance Method Details
#_perform_job ⇒ Object
586 587 588 589 |
# File 'lib/logbrew/rails_integration.rb', line 586 def _perform_job operation = @logbrew_perform_operation operation.nil? ? super : operation.around { super } end |
#deserialize(payload) ⇒ Object
556 557 558 559 560 561 562 563 564 |
# File 'lib/logbrew/rails_integration.rb', line 556 def deserialize(payload) result = super begin @logbrew_queue_carrier = QueueCarrier.read(payload[QueueCarrier::KEY]) if payload.is_a?(Hash) rescue StandardError => error LogBrew::Rails.runtime&.report_error("active_job_capture", error) end result end |
#enqueue(options = {}) ⇒ Object
532 533 534 535 536 537 538 539 540 541 |
# File 'lib/logbrew/rails_integration.rb', line 532 def enqueue( = {}) operation = ActiveJobOperation.create(LogBrew::Rails.runtime, self, :enqueue) return super if operation.nil? previous = @logbrew_enqueue_operation @logbrew_enqueue_operation = operation operation.around { super } ensure @logbrew_enqueue_operation = previous unless operation.nil? end |
#perform_now ⇒ Object
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 |
# File 'lib/logbrew/rails_integration.rb', line 566 def perform_now operation = ActiveJobOperation.create(LogBrew::Rails.runtime, self, :perform, carrier: @logbrew_queue_carrier) return super if operation.nil? previous = @logbrew_perform_operation @logbrew_perform_operation = operation begin Trace.with_context(operation.context) { super } rescue Exception => error # rubocop:disable Lint/RescueException operation.finish(error) operation.capture_terminal_issue(error) raise ensure unless operation.nil? operation.finish @logbrew_perform_operation = previous end end end |
#serialize ⇒ Object
543 544 545 546 547 548 549 550 551 552 553 554 |
# File 'lib/logbrew/rails_integration.rb', line 543 def serialize payload = super operation = @logbrew_enqueue_operation return payload if operation.nil? begin payload[QueueCarrier::KEY] = QueueCarrier.create(operation.context) rescue StandardError => error LogBrew::Rails.runtime&.report_error("active_job_capture", error) end payload end |