mirror of https://github.com/waku-org/nwaku.git
Add Swap account Metrics to Grafana (#585)
* Fix gcsafe issues with log account metrics function Signed-off-by: kripsonud <kripsonud@gmail.com> * Change Line ending to LF * Minor changes to waku_swap * Mount keepalive on chat2bridge and bridge (#591) * Light push beta bump (#590) Closes https://github.com/status-im/nim-waku/issues/565 * Filter and lightpush showcase (#593) * Filter and lightpush showcase * Fix log error * Add swap account panel to grafana dashboard template Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com> Co-authored-by: Oskar Thorén <ot@oskarthoren.com>
This commit is contained in:
parent
b615c6aa8b
commit
e2185caf27
|
@ -878,6 +878,104 @@
|
||||||
"align": false,
|
"align": false,
|
||||||
"alignLevel": null
|
"alignLevel": null
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 21,
|
||||||
|
"gridPos": {
|
||||||
|
"h": 9,
|
||||||
|
"w": 8,
|
||||||
|
"x": 16,
|
||||||
|
"y": 14
|
||||||
|
},
|
||||||
|
"type": "graph",
|
||||||
|
"title": "Waku Swap Accounts #0",
|
||||||
|
"thresholds": [],
|
||||||
|
"pluginVersion": "8.0.0-beta2",
|
||||||
|
"legend": {
|
||||||
|
"avg": false,
|
||||||
|
"current": false,
|
||||||
|
"max": false,
|
||||||
|
"min": false,
|
||||||
|
"show": true,
|
||||||
|
"total": false,
|
||||||
|
"values": false
|
||||||
|
},
|
||||||
|
"aliasColors": {},
|
||||||
|
"bars": false,
|
||||||
|
"dashLength": 10,
|
||||||
|
"dashes": false,
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"links": []
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
|
"fill": 1,
|
||||||
|
"fillGradient": 0,
|
||||||
|
"hiddenSeries": false,
|
||||||
|
"lines": true,
|
||||||
|
"linewidth": 1,
|
||||||
|
"nullPointMode": "null",
|
||||||
|
"options": {
|
||||||
|
"alertThreshold": true
|
||||||
|
},
|
||||||
|
"percentage": false,
|
||||||
|
"pointradius": 2,
|
||||||
|
"points": false,
|
||||||
|
"renderer": "flot",
|
||||||
|
"seriesOverrides": [],
|
||||||
|
"spaceLength": 10,
|
||||||
|
"stack": false,
|
||||||
|
"steppedLine": false,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"exemplar": true,
|
||||||
|
"expr": "waku_swap_account_state{node=\"0\"}",
|
||||||
|
"hide": false,
|
||||||
|
"instant": false,
|
||||||
|
"interval": "",
|
||||||
|
"legendFormat": "Peer: {{peer}}",
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timeFrom": null,
|
||||||
|
"timeRegions": [],
|
||||||
|
"timeShift": null,
|
||||||
|
"tooltip": {
|
||||||
|
"shared": true,
|
||||||
|
"sort": 1,
|
||||||
|
"value_type": "individual"
|
||||||
|
},
|
||||||
|
"xaxis": {
|
||||||
|
"buckets": null,
|
||||||
|
"mode": "time",
|
||||||
|
"name": null,
|
||||||
|
"show": true,
|
||||||
|
"values": []
|
||||||
|
},
|
||||||
|
"yaxes": [
|
||||||
|
{
|
||||||
|
"format": "short",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"format": "short",
|
||||||
|
"label": null,
|
||||||
|
"logBase": 1,
|
||||||
|
"max": null,
|
||||||
|
"min": null,
|
||||||
|
"show": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"yaxis": {
|
||||||
|
"align": false,
|
||||||
|
"alignLevel": null
|
||||||
|
},
|
||||||
|
"datasource": null
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"refresh": "30s",
|
"refresh": "30s",
|
||||||
|
|
|
@ -38,6 +38,7 @@ export waku_swap_types
|
||||||
|
|
||||||
declarePublicGauge waku_swap_peers, "number of swap peers"
|
declarePublicGauge waku_swap_peers, "number of swap peers"
|
||||||
declarePublicGauge waku_swap_errors, "number of swap protocol errors", ["type"]
|
declarePublicGauge waku_swap_errors, "number of swap protocol errors", ["type"]
|
||||||
|
declarePublicGauge waku_swap_account_state, "swap account state for each peer", ["peer"]
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
topics = "wakuswap"
|
topics = "wakuswap"
|
||||||
|
@ -191,6 +192,11 @@ proc handleCheque*(ws: WakuSwap, cheque: Cheque) =
|
||||||
|
|
||||||
info "New accounting state", accounting = ws.accounting[peerId]
|
info "New accounting state", accounting = ws.accounting[peerId]
|
||||||
|
|
||||||
|
# Log Account Metrics
|
||||||
|
proc logAccountMetrics*(ws: Wakuswap, peer: PeerId) {.async.}=
|
||||||
|
waku_swap_account_state.set(ws.accounting[peer].int64, labelValues = [$peer])
|
||||||
|
|
||||||
|
|
||||||
proc init*(wakuSwap: WakuSwap) =
|
proc init*(wakuSwap: WakuSwap) =
|
||||||
info "wakuSwap init 1"
|
info "wakuSwap init 1"
|
||||||
proc handle(conn: Connection, proto: string) {.async, gcsafe, closure.} =
|
proc handle(conn: Connection, proto: string) {.async, gcsafe, closure.} =
|
||||||
|
@ -242,6 +248,8 @@ proc init*(wakuSwap: WakuSwap) =
|
||||||
else:
|
else:
|
||||||
info "Payment threshhold not hit"
|
info "Payment threshhold not hit"
|
||||||
|
|
||||||
|
waitFor wakuSwap.logAccountMetrics(peerId)
|
||||||
|
|
||||||
wakuSwap.handler = handle
|
wakuSwap.handler = handle
|
||||||
wakuSwap.codec = WakuSwapCodec
|
wakuSwap.codec = WakuSwapCodec
|
||||||
wakuSwap.credit = credit
|
wakuSwap.credit = credit
|
||||||
|
|
Loading…
Reference in New Issue