Module: Taskinator::Instrumentation

Included in:
Process, Task
Defined in:
lib/taskinator/instrumentation.rb

Instance Method Summary collapse

Instance Method Details

#cancelled_payload(additional = {}) ⇒ Object



32
33
34
# File 'lib/taskinator/instrumentation.rb', line 32

def cancelled_payload(additional={})
  payload_for(:cancelled, additional)
end

#completed_payload(additional = {}) ⇒ Object



28
29
30
# File 'lib/taskinator/instrumentation.rb', line 28

def completed_payload(additional={})
  payload_for(:completed, additional)
end

#enqueued_payload(additional = {}) ⇒ Object

helper methods for instrumentation payloads



12
13
14
# File 'lib/taskinator/instrumentation.rb', line 12

def enqueued_payload(additional={})
  payload_for(:enqueued, additional)
end

#failed_payload(exception, additional = {}) ⇒ Object



36
37
38
# File 'lib/taskinator/instrumentation.rb', line 36

def failed_payload(exception, additional={})
  payload_for(:failed, { :exception => exception.to_s, :backtrace => exception.backtrace }.merge(additional))
end

#instrument(event, payload = {}) ⇒ Object



4
5
6
7
8
# File 'lib/taskinator/instrumentation.rb', line 4

def instrument(event, payload={})
  Taskinator.instrumenter.instrument(event, payload) do
    yield
  end
end

#paused_payload(additional = {}) ⇒ Object



20
21
22
# File 'lib/taskinator/instrumentation.rb', line 20

def paused_payload(additional={})
  payload_for(:paused, additional)
end

#processing_payload(additional = {}) ⇒ Object



16
17
18
# File 'lib/taskinator/instrumentation.rb', line 16

def processing_payload(additional={})
  payload_for(:processing, additional)
end

#resumed_payload(additional = {}) ⇒ Object



24
25
26
# File 'lib/taskinator/instrumentation.rb', line 24

def resumed_payload(additional={})
  payload_for(:resumed, additional)
end