mirror of
https://github.com/penpot/penpot.git
synced 2025-07-13 21:07:18 +02: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))))
|
(p/rejected cause))))
|
||||||
|
|
||||||
(eval-script [sha]
|
(eval-script [sha]
|
||||||
(let [start-ts (System/nanoTime)]
|
(let [tpoint (dt/tpoint)]
|
||||||
(-> (.evalsha ^RedisScriptingAsyncCommands cmd
|
(-> (.evalsha ^RedisScriptingAsyncCommands cmd
|
||||||
^String sha
|
^String sha
|
||||||
^ScriptOutputType ScriptOutputType/MULTI
|
^ScriptOutputType ScriptOutputType/MULTI
|
||||||
^"[Ljava.lang.String;" keys
|
^"[Ljava.lang.String;" keys
|
||||||
^"[Ljava.lang.String;" vals)
|
^"[Ljava.lang.String;" vals)
|
||||||
(p/then (fn [result]
|
(p/then (fn [result]
|
||||||
(let [elapsed (dt/duration {:nanos (- (System/nanoTime) start-ts)})]
|
(let [elapsed (tpoint)]
|
||||||
(mtx/run! metrics {:id :redis-eval-timing
|
(mtx/run! metrics {:id :redis-eval-timing
|
||||||
:labels [(name sname)]
|
:labels [(name sname)]
|
||||||
:val (inst-ms elapsed)})
|
:val (inst-ms elapsed)})
|
||||||
|
|
|
@ -325,3 +325,13 @@
|
||||||
CronExpression
|
CronExpression
|
||||||
(-edn [o] (pr-str o)))
|
(-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
Add a link
Reference in a new issue