Add metrics to track the distance of content requested and offered (#1903)
This commit is contained in:
parent
c46706ac75
commit
11e3171723
|
@ -232,6 +232,75 @@
|
|||
"title": "RSS mem",
|
||||
"type": "stat"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "P5354BB48EF90EBE5"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "thresholds"
|
||||
},
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
},
|
||||
"unit": "bytes"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 2,
|
||||
"w": 2,
|
||||
"x": 6,
|
||||
"y": 0
|
||||
},
|
||||
"id": 51,
|
||||
"options": {
|
||||
"colorMode": "value",
|
||||
"graphMode": "none",
|
||||
"justifyMode": "auto",
|
||||
"orientation": "auto",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"text": {},
|
||||
"textMode": "auto"
|
||||
},
|
||||
"pluginVersion": "9.2.5",
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "P5354BB48EF90EBE5"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"exemplar": false,
|
||||
"expr": "nim_gc_mem_occupied_bytes{instance=\"${instance}\",container=\"${container}\"}",
|
||||
"interval": "",
|
||||
"legendFormat": "",
|
||||
"range": true,
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "GC Mem Used",
|
||||
"type": "stat"
|
||||
},
|
||||
{
|
||||
"aliasColors": {},
|
||||
"bars": false,
|
||||
|
@ -579,11 +648,13 @@
|
|||
"type": "prometheus",
|
||||
"uid": "P5354BB48EF90EBE5"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"exemplar": false,
|
||||
"expr": "sum(nim_gc_mem_occupied_bytes{instance=\"${instance}\",container=\"${container}\"})",
|
||||
"hide": false,
|
||||
"interval": "",
|
||||
"legendFormat": "Nim GC mem used",
|
||||
"range": true,
|
||||
"refId": "E"
|
||||
}
|
||||
],
|
||||
|
@ -2133,6 +2204,76 @@
|
|||
"align": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "P5354BB48EF90EBE5"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "thresholds"
|
||||
},
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 10,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 68
|
||||
},
|
||||
"id": 52,
|
||||
"options": {
|
||||
"displayMode": "gradient",
|
||||
"minVizHeight": 10,
|
||||
"minVizWidth": 0,
|
||||
"orientation": "auto",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"showUnfilled": true,
|
||||
"text": {}
|
||||
},
|
||||
"pluginVersion": "9.2.5",
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "P5354BB48EF90EBE5"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"exemplar": false,
|
||||
"expr": "portal_find_content_log_distance_bucket{instance=\"${instance}\",container=\"${container}\"}",
|
||||
"format": "heatmap",
|
||||
"hide": false,
|
||||
"interval": "",
|
||||
"legendFormat": "{{le}}",
|
||||
"range": true,
|
||||
"refId": "B"
|
||||
}
|
||||
],
|
||||
"title": "log. distance of requested content ",
|
||||
"type": "bargauge"
|
||||
},
|
||||
{
|
||||
"aliasColors": {},
|
||||
"bars": false,
|
||||
|
@ -2267,7 +2408,8 @@
|
|||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green"
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
|
@ -2328,6 +2470,76 @@
|
|||
],
|
||||
"title": "History network pruning statistics",
|
||||
"type": "timeseries"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "P5354BB48EF90EBE5"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "thresholds"
|
||||
},
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 10,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 78
|
||||
},
|
||||
"id": 53,
|
||||
"options": {
|
||||
"displayMode": "gradient",
|
||||
"minVizHeight": 10,
|
||||
"minVizWidth": 0,
|
||||
"orientation": "auto",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"showUnfilled": true,
|
||||
"text": {}
|
||||
},
|
||||
"pluginVersion": "9.2.5",
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "P5354BB48EF90EBE5"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"exemplar": false,
|
||||
"expr": "portal_offer_log_distance_bucket{instance=\"${instance}\",container=\"${container}\"}",
|
||||
"format": "heatmap",
|
||||
"hide": false,
|
||||
"interval": "",
|
||||
"legendFormat": "{{le}}",
|
||||
"range": true,
|
||||
"refId": "B"
|
||||
}
|
||||
],
|
||||
"title": "log. distance of offered content",
|
||||
"type": "bargauge"
|
||||
}
|
||||
],
|
||||
"refresh": "5s",
|
||||
|
@ -2398,6 +2610,6 @@
|
|||
"timezone": "",
|
||||
"title": "Nimbus Fluffy Dashboard",
|
||||
"uid": "iWQQPuPnkadsf",
|
||||
"version": 10,
|
||||
"version": 11,
|
||||
"weekStart": ""
|
||||
}
|
|
@ -66,7 +66,6 @@ declareCounter portal_gossip_without_lookup,
|
|||
"Portal wire protocol neighborhood gossip that did not require a node lookup",
|
||||
labels = ["protocol_id"]
|
||||
|
||||
|
||||
# Note: These metrics are to get some idea on how many enrs are send on average.
|
||||
# Relevant issue: https://github.com/ethereum/portal-network-specs/issues/136
|
||||
const enrsBuckets = [0.0, 1.0, 3.0, 5.0, 8.0, 9.0, Inf]
|
||||
|
@ -79,6 +78,17 @@ declareHistogram portal_content_enrs_packed,
|
|||
"Portal wire protocol amount of enrs packed in a content message",
|
||||
labels = ["protocol_id"], buckets = enrsBuckets
|
||||
|
||||
const distanceBuckets =
|
||||
[float64 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252,
|
||||
253, 254, 255, 256]
|
||||
declareHistogram portal_find_content_log_distance,
|
||||
"Portal wire protocol logarithmic distance of requested content",
|
||||
labels = ["protocol_id"], buckets = distanceBuckets
|
||||
|
||||
declareHistogram portal_offer_log_distance,
|
||||
"Portal wire protocol logarithmic distance of offered content",
|
||||
labels = ["protocol_id"], buckets = distanceBuckets
|
||||
|
||||
logScope:
|
||||
topics = "portal_wire"
|
||||
|
||||
|
@ -349,6 +359,10 @@ proc handleFindContent(
|
|||
# discv5 layer.
|
||||
return @[]
|
||||
|
||||
let logDistance = p.routingTable.logDistance(contentId, p.localNode.id)
|
||||
portal_find_content_log_distance.observe(
|
||||
int64(logDistance), labelValues = [$p.protocolId])
|
||||
|
||||
let contentResult = p.dbGet(fc.contentKey, contentId)
|
||||
|
||||
if contentResult.isOk():
|
||||
|
@ -391,6 +405,11 @@ proc handleOffer(p: PortalProtocol, o: OfferMessage, srcId: NodeId): seq[byte] =
|
|||
let contentIdResult = p.toContentId(contentKey)
|
||||
if contentIdResult.isOk():
|
||||
let contentId = contentIdResult.get()
|
||||
|
||||
let logDistance = p.routingTable.logDistance(contentId, p.localNode.id)
|
||||
portal_offer_log_distance.observe(
|
||||
int64(logDistance), labelValues = [$p.protocolId])
|
||||
|
||||
if p.inRange(contentId):
|
||||
if p.dbGet(contentKey, contentId).isErr:
|
||||
contentKeysBitList.setBit(i)
|
||||
|
|
|
@ -65,11 +65,11 @@ proc init*(
|
|||
disablePoke: disablePoke
|
||||
)
|
||||
|
||||
proc fromLogRadius*(T: type UInt256, logRadius: uint16): T =
|
||||
func fromLogRadius*(T: type UInt256, logRadius: uint16): T =
|
||||
# Get the max value of the logRadius range
|
||||
pow((2).stuint(256), logRadius) - 1
|
||||
|
||||
proc getInitialRadius*(rc: RadiusConfig): UInt256 =
|
||||
func getInitialRadius*(rc: RadiusConfig): UInt256 =
|
||||
case rc.kind
|
||||
of Static:
|
||||
return UInt256.fromLogRadius(rc.logRadius)
|
||||
|
|
Loading…
Reference in New Issue