Class: VSM::Monitoring

Inherits:
Object
  • Object
show all
Defined in:
lib/vsm/observability/ledger.rb

Constant Summary collapse

LOG =
File.expand_path(".vsm.log.jsonl", Dir.pwd)

Instance Method Summary collapse

Instance Method Details

#handleObject



22
# File 'lib/vsm/observability/ledger.rb', line 22

def handle(*) = false

#observe(bus) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/vsm/observability/ledger.rb', line 9

def observe(bus)
  bus.subscribe do |msg|
    event = {
      ts: Time.now.utc.iso8601,
      kind: msg.kind,
      path: msg.path,
      corr_id: msg.corr_id,
      meta: msg.meta
    }
    File.open(LOG, "a") { |f| f.puts(event.to_json) } rescue nil
  end
end