Skip to content

Commit

Permalink
Latest heatmap + dash
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyaxod committed Nov 27, 2024
1 parent 47d2067 commit fd254ec
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 26 deletions.
15 changes: 15 additions & 0 deletions pkg/storage/protocol/from_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ type FromProtocol struct {
provAltSources storage.Provider

providerFactory func(*packets.DevInfo) storage.Provider
devInfo *packets.DevInfo
protocol Protocol
init chan bool
initLock sync.Mutex
ctx context.Context

// Collect alternate sources
Expand Down Expand Up @@ -76,7 +78,9 @@ type FromProtocolMetrics struct {
WritesBlockedAltSources uint64
NumBlocks uint64
AvailableP2P []uint
DuplicateP2P []uint
AvailableAltSources []uint
DeviceName string
}

func NewFromProtocol(ctx context.Context, dev uint32, provFactory func(*packets.DevInfo) storage.Provider, protocol Protocol) *FromProtocol {
Expand Down Expand Up @@ -117,6 +121,13 @@ func (fp *FromProtocol) GetMetrics() *FromProtocolMetrics {
WritesAllowedAltSources: 0,
WritesBlockedAltSources: 0,
NumBlocks: 0,
DeviceName: "",
}

fp.initLock.Lock()
defer fp.initLock.Unlock()
if fp.devInfo != nil {
fpm.DeviceName = fp.devInfo.Name
}

if fp.writeCombinator != nil {
Expand All @@ -127,6 +138,7 @@ func (fp *FromProtocol) GetMetrics() *FromProtocolMetrics {
fpm.WritesBlockedAltSources = met.WritesBlocked[priorityAltSources]
fpm.AvailableP2P = met.AvailableBlocks[priorityP2P]
fpm.AvailableAltSources = met.AvailableBlocks[priorityAltSources]
fpm.DuplicateP2P = met.DuplicatedBlocks[priorityP2P]
fpm.NumBlocks = uint64(met.NumBlocks)
}
return fpm
Expand Down Expand Up @@ -244,10 +256,13 @@ func (fp *FromProtocol) HandleDevInfo() error {
atomic.AddUint64(&fp.metricRecvDevInfo, 1)

// Create storage, and setup a writeCombinator with two inputs
fp.initLock.Lock()
fp.prov = fp.providerFactory(di)
fp.devInfo = di
fp.writeCombinator = modules.NewWriteCombinator(fp.prov, int(di.BlockSize))
fp.provAltSources = fp.writeCombinator.AddSource(priorityAltSources)
fp.provP2P = fp.writeCombinator.AddSource(priorityP2P)
fp.initLock.Unlock()

fp.init <- true // Confirm things have been initialized for this device.

Expand Down
130 changes: 104 additions & 26 deletions telemetry/grafana/provisioning/dashboards/silo/silo.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,91 @@
}
],
"panels": [
{
"datasource": {
"type": "prometheus",
"uid": "ds_prometheus"
},
"fieldConfig": {
"defaults": {
"custom": {
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"scaleDistribution": {
"type": "linear"
}
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 0
},
"id": 28,
"options": {
"calculate": false,
"cellGap": 1,
"color": {
"exponent": 0.5,
"fill": "dark-orange",
"mode": "scheme",
"reverse": false,
"scale": "exponential",
"scheme": "BrBG",
"steps": 64
},
"exemplars": {
"color": "rgba(255,0,255,0.7)"
},
"filterValues": {
"le": 1e-9
},
"legend": {
"show": true
},
"rowsFrame": {
"layout": "auto"
},
"tooltip": {
"mode": "single",
"showColorScale": false,
"yHistogram": false
},
"yAxis": {
"axisPlacement": "left",
"reverse": false
}
},
"pluginVersion": "11.3.0",
"targets": [
{
"editorMode": "code",
"exemplar": false,
"expr": "sum(silo_fromProtocol_heatmap{device=\"memory\"}) by (le)",
"format": "time_series",
"instant": false,
"interval": "1s",
"legendFormat": "__auto",
"range": true,
"refId": "A"
}
],
"title": "Memory blocks",
"type": "heatmap"
},
{
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 0
"y": 8
},
"id": 24,
"panels": [],
Expand Down Expand Up @@ -71,7 +149,7 @@
"h": 7,
"w": 12,
"x": 0,
"y": 1
"y": 9
},
"id": 22,
"options": {
Expand Down Expand Up @@ -121,9 +199,9 @@
"targets": [
{
"editorMode": "code",
"expr": "rate(silo_volatilityMonitor_heatmap_bucket{instance=\"localhost:2112\", device=\"disk\"}[10s])",
"expr": "rate(silo_volatilityMonitor_heatmap_bucket{instance=\"localhost:2112\", device=\"disk\"}[1s])",
"format": "heatmap",
"interval": "10s",
"interval": "1s",
"legendFormat": "__auto",
"range": true,
"refId": "A"
Expand Down Expand Up @@ -156,7 +234,7 @@
"h": 7,
"w": 12,
"x": 12,
"y": 1
"y": 9
},
"id": 25,
"options": {
Expand Down Expand Up @@ -206,9 +284,9 @@
"targets": [
{
"editorMode": "code",
"expr": "rate(silo_volatilityMonitor_heatmap_bucket{instance=\"localhost:2112\", device=\"memory\"}[10s])",
"expr": "rate(silo_volatilityMonitor_heatmap_bucket{instance=\"localhost:2112\", device=\"memory\"}[1s])",
"format": "heatmap",
"interval": "10s",
"interval": "1s",
"legendFormat": "__auto",
"range": true,
"refId": "A"
Expand Down Expand Up @@ -241,7 +319,7 @@
"h": 7,
"w": 12,
"x": 0,
"y": 8
"y": 16
},
"id": 26,
"options": {
Expand Down Expand Up @@ -326,7 +404,7 @@
"h": 7,
"w": 12,
"x": 12,
"y": 8
"y": 16
},
"id": 23,
"options": {
Expand Down Expand Up @@ -393,7 +471,7 @@
"h": 1,
"w": 24,
"x": 0,
"y": 15
"y": 23
},
"id": 21,
"panels": [],
Expand Down Expand Up @@ -464,7 +542,7 @@
"h": 8,
"w": 12,
"x": 0,
"y": 16
"y": 24
},
"id": 19,
"options": {
Expand Down Expand Up @@ -572,7 +650,7 @@
"h": 8,
"w": 12,
"x": 12,
"y": 16
"y": 24
},
"id": 20,
"options": {
Expand Down Expand Up @@ -620,7 +698,7 @@
"h": 1,
"w": 24,
"x": 0,
"y": 24
"y": 32
},
"id": 13,
"panels": [],
Expand Down Expand Up @@ -692,7 +770,7 @@
"h": 6,
"w": 12,
"x": 0,
"y": 25
"y": 33
},
"id": 2,
"options": {
Expand Down Expand Up @@ -792,7 +870,7 @@
"h": 6,
"w": 12,
"x": 12,
"y": 25
"y": 33
},
"id": 5,
"options": {
Expand Down Expand Up @@ -827,7 +905,7 @@
"h": 1,
"w": 24,
"x": 0,
"y": 31
"y": 39
},
"id": 12,
"panels": [],
Expand Down Expand Up @@ -899,7 +977,7 @@
"h": 9,
"w": 12,
"x": 0,
"y": 32
"y": 40
},
"id": 15,
"options": {
Expand Down Expand Up @@ -1007,7 +1085,7 @@
"h": 9,
"w": 12,
"x": 12,
"y": 32
"y": 40
},
"id": 7,
"options": {
Expand Down Expand Up @@ -1056,7 +1134,7 @@
"h": 1,
"w": 24,
"x": 0,
"y": 41
"y": 49
},
"id": 11,
"panels": [],
Expand Down Expand Up @@ -1128,7 +1206,7 @@
"h": 5,
"w": 12,
"x": 0,
"y": 42
"y": 50
},
"id": 3,
"options": {
Expand Down Expand Up @@ -1223,7 +1301,7 @@
"h": 5,
"w": 12,
"x": 12,
"y": 42
"y": 50
},
"id": 1,
"options": {
Expand Down Expand Up @@ -1320,7 +1398,7 @@
"h": 5,
"w": 12,
"x": 0,
"y": 47
"y": 55
},
"id": 9,
"options": {
Expand Down Expand Up @@ -1413,7 +1491,7 @@
"h": 5,
"w": 12,
"x": 12,
"y": 47
"y": 55
},
"id": 4,
"options": {
Expand Down Expand Up @@ -1506,7 +1584,7 @@
"h": 6,
"w": 12,
"x": 0,
"y": 52
"y": 60
},
"id": 6,
"options": {
Expand Down Expand Up @@ -1605,7 +1683,7 @@
"h": 6,
"w": 12,
"x": 12,
"y": 52
"y": 60
},
"id": 8,
"options": {
Expand Down Expand Up @@ -1649,6 +1727,6 @@
"timezone": "browser",
"title": "Silo",
"uid": "ae324d16sary8b",
"version": 1,
"version": 3,
"weekStart": ""
}

0 comments on commit fd254ec

Please sign in to comment.