Module: SolidObserver::Correlated
- Defined in:
- lib/solid_observer/correlated.rb
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
5 6 7 8 9 |
# File 'lib/solid_observer/correlated.rb', line 5 def self.included(base) base.around_perform do |job, block| SolidObserver::Correlated.stamp(job.job_id) { block.call } end end |
.stamp(correlation_id) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/solid_observer/correlated.rb', line 11 def self.stamp(correlation_id) thread_local = Thread.current previous = thread_local[:solid_observer_correlation_id] thread_local[:solid_observer_correlation_id] = correlation_id if correlation_id.present? yield ensure thread_local[:solid_observer_correlation_id] = previous end |