Improve Swap Account Balance Metrics to make use of a Histogram (#628)

Modify metrics description

Add more buckets to the swap account metrics
This commit is contained in:
Ebube Sered Ud 2021-06-17 16:36:44 +01:00 committed by GitHub
parent 060381616d
commit eb49d3148c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -36,9 +36,11 @@ import
export waku_swap_types
declarePublicGauge waku_swap_peers, "number of swap peers"
const swapAccountBalanceBuckets = [-Inf, -200.0, -150.0, -100.0, -50.0, 0.0, 50.0, 100.0, 150.0, 200.0, Inf]
declarePublicGauge waku_swap_peers_count, "number of swap peers"
declarePublicGauge waku_swap_errors, "number of swap protocol errors", ["type"]
declarePublicGauge waku_swap_account_state, "swap account state for each peer", ["peer"]
declarePublicHistogram waku_peer_swap_account_balance, "Swap Account Balance for waku peers, aggregated into buckets based on threshold limits", buckets = swapAccountBalanceBuckets
logScope:
topics = "wakuswap"
@ -194,7 +196,7 @@ proc handleCheque*(ws: WakuSwap, cheque: Cheque) =
# Log Account Metrics
proc logAccountMetrics*(ws: Wakuswap, peer: PeerId) {.async.}=
waku_swap_account_state.set(ws.accounting[peer].int64, labelValues = [$peer])
waku_peer_swap_account_balance.observe(ws.accounting[peer].int64)
proc init*(wakuSwap: WakuSwap) =
@ -270,6 +272,6 @@ proc init*(T: type WakuSwap, peerManager: PeerManager, rng: ref BrHmacDrbgContex
proc setPeer*(ws: WakuSwap, peer: PeerInfo) =
ws.peerManager.addPeer(peer, WakuSwapCodec)
waku_swap_peers.inc()
waku_swap_peers_count.inc()
# TODO End to end communication