Class: RubyLLM::Monitoring::EventSubscriber

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_llm/monitoring/event_subscriber.rb

Constant Summary collapse

FILTERED_PAYLOAD_KEYS =
%i[
  chat
  input_messages
  messages_after
  model_info
  response
  result
  schema
  tool
  tool_call
  tool_calls
].freeze

Instance Method Summary collapse

Instance Method Details

#call(event) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ruby_llm/monitoring/event_subscriber.rb', line 17

def call(event)
  Event.create(
    allocations: event.allocations,
    cpu_time: event.cpu_time,
    duration: event.duration,
    end: event.end,
    gc_time: event.gc_time,
    idle_time: event.idle_time,
    name: event.name,
    payload: event.payload.except(*FILTERED_PAYLOAD_KEYS).compact,
    time: event.time,
    transaction_id: event.transaction_id
  )
end