Class: JobWorkflow::Instrumentation::LogSubscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/job_workflow/instrumentation/log_subscriber.rb

Overview

LogSubscriber handles JobWorkflow instrumentation events and produces structured JSON logs. It subscribes to ActiveSupport::Notifications events and formats them for logging.

Examples:

Enable log subscriber

```ruby
JobWorkflow::Instrumentation::LogSubscriber.attach_to(:job_workflow)
```

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.attach!Object

: () -> void



15
16
17
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 15

def attach!
  attach_to(NAMESPACE.to_sym)
end

Instance Method Details

#dependent_wait(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



94
95
96
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 94

def dependent_wait(event)
  # Tracing only - no log output (start/complete events handle logging)
end

#dependent_wait_complete(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



104
105
106
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 104

def dependent_wait_complete(event)
  log_event(event, :debug)
end

#dependent_wait_start(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



99
100
101
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 99

def dependent_wait_start(event)
  log_event(event, :debug)
end

#dry_run(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



119
120
121
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 119

def dry_run(event)
  # Tracing only - no log output (skip/execute events handle logging)
end

#dry_run_execute(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



129
130
131
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 129

def dry_run_execute(event)
  log_event(event, :debug)
end

#dry_run_skip(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



124
125
126
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 124

def dry_run_skip(event)
  log_event(event, :info)
end

#queue_pause(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



109
110
111
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 109

def queue_pause(event)
  log_event(event, :info)
end

#queue_resume(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



114
115
116
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 114

def queue_resume(event)
  log_event(event, :info)
end

#task(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



39
40
41
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 39

def task(event)
  # Tracing only - no log output (start/complete events handle logging)
end

#task_complete(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



49
50
51
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 49

def task_complete(event)
  log_event(event, :info)
end

#task_enqueue(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



64
65
66
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 64

def task_enqueue(event)
  log_event(event, :info)
end

#task_error(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



54
55
56
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 54

def task_error(event)
  log_event(event, :error)
end

#task_retry(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



69
70
71
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 69

def task_retry(event)
  log_event(event, :warn)
end

#task_skip(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



59
60
61
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 59

def task_skip(event)
  log_event(event, :info)
end

#task_start(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



44
45
46
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 44

def task_start(event)
  log_event(event, :info)
end

#throttle_acquire(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



74
75
76
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 74

def throttle_acquire(event)
  # Tracing only - no log output (start/complete events handle logging)
end

#throttle_acquire_complete(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



84
85
86
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 84

def throttle_acquire_complete(event)
  log_event(event, :debug)
end

#throttle_acquire_start(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



79
80
81
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 79

def throttle_acquire_start(event)
  log_event(event, :debug)
end

#throttle_release(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



89
90
91
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 89

def throttle_release(event)
  log_event(event, :debug)
end

#workflow(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



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

def workflow(event)
  # Tracing only - no log output (start/complete events handle logging)
end

#workflow_complete(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



34
35
36
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 34

def workflow_complete(event)
  log_event(event, :info)
end

#workflow_start(event) ⇒ Object

: (ActiveSupport::Notifications::Event) -> void



29
30
31
# File 'lib/job_workflow/instrumentation/log_subscriber.rb', line 29

def workflow_start(event)
  log_event(event, :info)
end