mirror of https://github.com/status-im/nim-eth.git
SQLite3 metrics: cosmetic changes
This commit is contained in:
parent
9da92b5415
commit
8ded65fe0e
|
@ -3,8 +3,8 @@
|
||||||
{.push raises: [Defect].}
|
{.push raises: [Defect].}
|
||||||
|
|
||||||
import
|
import
|
||||||
os, tables, times,
|
os,
|
||||||
chronicles, metrics, sqlite3_abi,
|
sqlite3_abi,
|
||||||
./kvstore
|
./kvstore
|
||||||
|
|
||||||
export kvstore
|
export kvstore
|
||||||
|
@ -164,6 +164,9 @@ proc init*(
|
||||||
))
|
))
|
||||||
|
|
||||||
when defined(metrics):
|
when defined(metrics):
|
||||||
|
import tables, times,
|
||||||
|
chronicles, metrics
|
||||||
|
|
||||||
type Sqlite3Info = ref object of Gauge
|
type Sqlite3Info = ref object of Gauge
|
||||||
|
|
||||||
proc newSqlite3Info*(name: string, help: string, registry = defaultRegistry): Sqlite3Info {.raises: [Exception].} =
|
proc newSqlite3Info*(name: string, help: string, registry = defaultRegistry): Sqlite3Info {.raises: [Exception].} =
|
||||||
|
@ -179,11 +182,10 @@ when defined(metrics):
|
||||||
method collect*(collector: Sqlite3Info): Metrics =
|
method collect*(collector: Sqlite3Info): Metrics =
|
||||||
result = initOrderedTable[Labels, seq[Metric]]()
|
result = initOrderedTable[Labels, seq[Metric]]()
|
||||||
result[@[]] = @[]
|
result[@[]] = @[]
|
||||||
var
|
let timestamp = getTime().toMilliseconds()
|
||||||
timestamp = getTime().toMilliseconds()
|
var currentMem, highwaterMem: int64
|
||||||
currentMem, highwaterMem: cint
|
|
||||||
|
|
||||||
if (let res = sqlite3_status(SQLITE_STATUS_MEMORY_USED, currentMem.addr, highwaterMem.addr, 0); res != SQLITE_OK):
|
if (let res = sqlite3_status64(SQLITE_STATUS_MEMORY_USED, currentMem.addr, highwaterMem.addr, 0); res != SQLITE_OK):
|
||||||
error "SQLite3 error", msg = sqlite3_errstr(res)
|
error "SQLite3 error", msg = sqlite3_errstr(res)
|
||||||
else:
|
else:
|
||||||
result[@[]] = @[
|
result[@[]] = @[
|
||||||
|
|
Loading…
Reference in New Issue