metrics: initialise lock for custom collector

This commit is contained in:
Ștefan Talpalaru 2021-07-02 16:43:26 +02:00 committed by zah
parent a10d301085
commit 2dfd352fd0
1 changed files with 2 additions and 1 deletions

View File

@ -550,7 +550,7 @@ proc openKvStore*(db: SqStoreRef, name = "kvstore", withoutRowid = false): KvRes
ok res
when defined(metrics):
import tables, times,
import locks, tables, times,
chronicles, metrics
type Sqlite3Info = ref object of Gauge
@ -561,6 +561,7 @@ when defined(metrics):
help: help,
typ: "gauge",
creationThreadId: getThreadId())
result.lock.initLock()
result.register(registry)
var sqlite3Info* {.global.} = newSqlite3Info("sqlite3_info", "SQLite3 info")