Class: SystemMetrics::Store

Inherits:
Object
  • Object
show all
Defined in:
lib/system_metrics/store.rb

Instance Method Summary collapse

Instance Method Details

#save(events) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/system_metrics/store.rb', line 4

def save(events)
  return unless events.present?
  root_event = SystemMetrics::NestedEvent.arrange(events, :presort => false)
  root_model = create_metric(root_event)
  root_model.update_attributes(:request_id => root_model.id)
  save_tree(root_event.children, root_model.id, root_model.id)
end