 
 (defn- insertEnd
   [usage-event-json options]
+  (log/debug "insertEnd usage-event-json " usage-event-json)
   (doseq [usage-metric (usage-metrics usage-event-json)]
     (process-metric-event usage-metric :stop options)))
 

(defn- metric-summary
  [usage-metric]
  (str (:start-timestamp usage-metric)
       " " (:cloud-vm-instanceid usage-metric)
       " [" (:metric-name usage-metric) "/" (:metric-value usage-metric) "]"))

(defn- close-record
  ([usage-metric close-timestamp options]
   (log/debug "Closing usage-record " close-timestamp (metric-summary usage-metric))
   (doseq [ur (ur/open-records usage-metric)]
     (db/edit (assoc ur :end-timestamp close-timestamp) options)))
  ([usage-metric options]
   (close-record usage-metric (:end-timestamp usage-metric) options)))

(defn- open-record
  [usage-metric options]
  (log/debug "Opening usage-record " (metric-summary usage-metric))
  (log/debug "open: options " options)
  (let [new-record (-> usage-metric
                       (assoc :resourceURI ur/resource-uri)
                       (assoc :id (str "usage-record/" (cu/random-uuid)))
