lib/dcmgr/models/request_log.rb in wakame-vdc-dcmgr-10.12.0 vs lib/dcmgr/models/request_log.rb in wakame-vdc-dcmgr-11.06.0

- old
+ new

@@ -3,23 +3,38 @@ module Dcmgr::Models class RequestLog < BaseNew inheritable_schema do String :request_id, :null=>false, :size=>40, :unique=>true - Fixnum :frontend_system_id, :null=>false - Fixnum :account_id, :null=>false - String :requester_symbol, :null=>false, :size=>100 - # HTTP Response Code - Fixnum :response_status, :null=>false - String :response_msg + String :frontend_system_id, :null=>false, :size=>40 + String :account_id, :null=>false, :size=>40 + String :requester_token, :null=>true, :size=>100 + # HTTP Request Content + String :request_method, :null=>false, :size=>10 String :api_path, :null=>false - String :params, :null=>false - Time :requested_at - Time :responsed_at + Text :params, :null=>false + # HTTP Response Content + Fixnum :response_status, :null=>false + Text :response_msg, :null=>true + Time :requested_at, :null=>false + Fixnum :requested_at_usec, :null=>false, :unsigned=>true + Time :responded_at, :null=>false + Fixnum :responded_at_usec, :null=>false, :unsigned=>true end def after_initialize - self[:request_id] # + super + self[:request_id] ||= Isono::Util.gen_id + t = Time.now + self[:requested_at] = t + self[:requested_at_usec] = t.usec end - + + def before_create + super + t = Time.now + self[:responded_at] = t + self[:responded_at_usec] = t.usec + end + end end