mirror of
https://github.com/penpot/penpot.git
synced 2025-04-16 08:51:32 -05:00
🎉 Add improved approach for async flow time measurements
This commit is contained in:
parent
fd973d87fd
commit
2f21560fe3
2 changed files with 12 additions and 2 deletions
|
@ -283,14 +283,14 @@
|
|||
(p/rejected cause))))
|
||||
|
||||
(eval-script [sha]
|
||||
(let [start-ts (System/nanoTime)]
|
||||
(let [tpoint (dt/tpoint)]
|
||||
(-> (.evalsha ^RedisScriptingAsyncCommands cmd
|
||||
^String sha
|
||||
^ScriptOutputType ScriptOutputType/MULTI
|
||||
^"[Ljava.lang.String;" keys
|
||||
^"[Ljava.lang.String;" vals)
|
||||
(p/then (fn [result]
|
||||
(let [elapsed (dt/duration {:nanos (- (System/nanoTime) start-ts)})]
|
||||
(let [elapsed (tpoint)]
|
||||
(mtx/run! metrics {:id :redis-eval-timing
|
||||
:labels [(name sname)]
|
||||
:val (inst-ms elapsed)})
|
||||
|
|
|
@ -325,3 +325,13 @@
|
|||
CronExpression
|
||||
(-edn [o] (pr-str o)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Measurement Helpers
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defn tpoint
|
||||
"Create a measurement checkpoint for time measurement of potentially
|
||||
asynchronous flow."
|
||||
[]
|
||||
(let [p1 (System/nanoTime)]
|
||||
#(duration {:nanos (- (System/nanoTime) p1)})))
|
||||
|
|
Loading…
Add table
Reference in a new issue