Class: LlmLogs::Trace
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- LlmLogs::Trace
- Defined in:
- app/models/llm_logs/trace.rb
Instance Method Summary collapse
Instance Method Details
#complete! ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'app/models/llm_logs/trace.rb', line 14 def complete! return if status == "completed" rollup_stats! update!( status: "completed", completed_at: Time.current, duration_ms: (Time.current - started_at) * 1000 ) end |
#fail! ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/models/llm_logs/trace.rb', line 25 def fail! rollup_stats! update!( status: "error", completed_at: Time.current, duration_ms: (Time.current - started_at) * 1000 ) end |
#root_spans ⇒ Object
34 35 36 |
# File 'app/models/llm_logs/trace.rb', line 34 def root_spans spans.where(parent_span_id: nil).order(:started_at) end |