                                     0
                                     (:tree (:onyx.core/results (task/get-event state)))))))))
 
-(defn update-rv-epoch [cnt-replica-version cnt-epoch epoch-rate]
+(defn update-rv-epoch [^AtomicLong replica-version ^AtomicLong epoch epoch-rate]
   (fn [state latency-ns]
     (m/mark! epoch-rate 1)
-    (c/inc! cnt-replica-version (- (task/replica-version state) 
-                                   (c/value cnt-replica-version)))
-    (c/inc! cnt-epoch (- (task/epoch state) (c/value cnt-epoch)))))
+    (.set ^AtomicLong replica-version (task/replica-version state))
+    (.set ^AtomicLong epoch (task/epoch state))))
 
 ;; FIXME, close counters and remove them from the registry
 (defn before-task [{:keys [onyx.core/job-id onyx.core/id onyx.core/monitoring

        reg (:registry monitoring)
        _ (when-not reg (throw (Exception. "Monitoring component is not setup")))
        tag ["job" job-name "task" task-name "peer-id" (str id)]
        cnt-replica-version (c/counter reg (conj tag "replica-version"))
        cnt-epoch (c/counter reg (conj tag "epoch"))
        epoch-rate (m/meter reg  (conj tag "epoch-rate"))
        update-rv-epoch-fn (update-rv-epoch cnt-replica-version cnt-epoch epoch-rate)]
    {:onyx.core/monitoring (reduce 
                            (fn [mon lifecycle]
                              (assoc mon 


(def calls
  {:lifecycle/before-task-start before-task})
