mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-03-10 11:03:14 +00:00
* feat(rln-relay): periodically log metrics * chore(rln-relay): log rln metrics immediately * fix(metrics): calculation etc * chore(metrics): parseAndAccumulate into collector utils * fix(metrics): use standard logging interval
19 lines
566 B
Nim
19 lines
566 B
Nim
import
|
|
metrics
|
|
|
|
proc parseCollectorIntoF64*(collector: Collector): float64 =
|
|
var total = 0.float64
|
|
for key in collector.metrics.keys():
|
|
try:
|
|
total = total + collector.value(key)
|
|
except KeyError:
|
|
discard
|
|
return total
|
|
|
|
template parseAndAccumulate*(collector: Collector, cumulativeValue: float64): float64 =
|
|
## This template is used to get metrics in a window
|
|
## according to a cumulative value passed in
|
|
let total = parseCollectorIntoF64(collector)
|
|
let freshCount = total - cumulativeValue
|
|
cumulativeValue = total
|
|
freshCount |