mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-02-05 17:43:50 +00:00
Applies statSummary metric in repostore.
This commit is contained in:
parent
92b6be0db1
commit
a9e55e665a
@ -32,6 +32,11 @@ const
|
||||
|
||||
when codex_enable_repostore_timinglogs:
|
||||
import std/monotimes
|
||||
import ../../utils/statsummary
|
||||
|
||||
let
|
||||
getBlockSummary = declareStatSummary("getBlock")
|
||||
putBlockSummary = declareStatSummary("putBlock")
|
||||
|
||||
export blocktype, cid
|
||||
|
||||
@ -70,6 +75,7 @@ method getBlock*(self: RepoStore, cid: Cid): Future[?!Block] {.async.} =
|
||||
when codex_enable_repostore_timinglogs:
|
||||
let durationUs = (getMonoTime().ticks - startTime) div 1000
|
||||
trace "Got block for cid", cid, durationUs
|
||||
getBlockSummary.observe(durationUs)
|
||||
else:
|
||||
trace "Got block for cid", cid
|
||||
|
||||
@ -215,6 +221,7 @@ method putBlock*(
|
||||
when codex_enable_repostore_timinglogs:
|
||||
let durationUs = (getMonoTime().ticks - startTime) div 1000
|
||||
trace "putBlock", durationUs
|
||||
putBlockSummary.observe(durationUs)
|
||||
|
||||
return success()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user