Skip to content

Commit b0d08c4

Browse files
authored
feat: add operator responses dashboard (#1648)
1 parent b767977 commit b0d08c4

File tree

3 files changed

+158
-14
lines changed

3 files changed

+158
-14
lines changed

grafana/provisioning/dashboards/aligned/aggregator_batcher.json

Lines changed: 141 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2732,7 +2732,7 @@
27322732
"mode": "continuous-GrYlRd"
27332733
},
27342734
"custom": {
2735-
"align": "auto",
2735+
"align": "left",
27362736
"cellOptions": {
27372737
"type": "auto"
27382738
},
@@ -2758,7 +2758,7 @@
27582758
{
27592759
"matcher": {
27602760
"id": "byName",
2761-
"options": "Max"
2761+
"options": "Last *"
27622762
},
27632763
"properties": [
27642764
{
@@ -2819,7 +2819,7 @@
28192819
"options": {
28202820
"labelsToFields": false,
28212821
"reducers": [
2822-
"max"
2822+
"lastNotNull"
28232823
]
28242824
}
28252825
},
@@ -2830,7 +2830,136 @@
28302830
"sort": [
28312831
{
28322832
"desc": true,
2833-
"field": "Max"
2833+
"field": "Last *"
2834+
}
2835+
]
2836+
}
2837+
}
2838+
],
2839+
"type": "table"
2840+
},
2841+
{
2842+
"datasource": {
2843+
"type": "prometheus",
2844+
"uid": "prometheus"
2845+
},
2846+
"fieldConfig": {
2847+
"defaults": {
2848+
"color": {
2849+
"fixedColor": "dark-green",
2850+
"mode": "fixed"
2851+
},
2852+
"custom": {
2853+
"align": "left",
2854+
"cellOptions": {
2855+
"type": "auto"
2856+
},
2857+
"inspect": false
2858+
},
2859+
"mappings": [],
2860+
"noValue": "none",
2861+
"thresholds": {
2862+
"mode": "absolute",
2863+
"steps": [
2864+
{
2865+
"color": "green",
2866+
"value": null
2867+
}
2868+
]
2869+
}
2870+
},
2871+
"overrides": [
2872+
{
2873+
"matcher": {
2874+
"id": "byName",
2875+
"options": "Last *"
2876+
},
2877+
"properties": [
2878+
{
2879+
"id": "custom.cellOptions",
2880+
"value": {
2881+
"mode": "lcd",
2882+
"type": "gauge",
2883+
"valueDisplayMode": "text"
2884+
}
2885+
}
2886+
]
2887+
}
2888+
]
2889+
},
2890+
"gridPos": {
2891+
"h": 8,
2892+
"w": 12,
2893+
"x": 12,
2894+
"y": 69
2895+
},
2896+
"id": 51,
2897+
"options": {
2898+
"cellHeight": "sm",
2899+
"footer": {
2900+
"countRows": false,
2901+
"fields": "",
2902+
"reducer": [
2903+
"sum"
2904+
],
2905+
"show": false
2906+
},
2907+
"showHeader": false
2908+
},
2909+
"pluginVersion": "10.1.10",
2910+
"targets": [
2911+
{
2912+
"datasource": {
2913+
"type": "prometheus",
2914+
"uid": "prometheus"
2915+
},
2916+
"disableTextWrap": false,
2917+
"editorMode": "code",
2918+
"exemplar": false,
2919+
"expr": "floor(increase(operator_response_count{job=\"aligned-tracker\"}[$__range]))",
2920+
"format": "time_series",
2921+
"fullMetaSearch": false,
2922+
"includeNullMetadata": true,
2923+
"instant": false,
2924+
"interval": "1",
2925+
"legendFormat": "{{operator}}",
2926+
"range": true,
2927+
"refId": "A",
2928+
"useBackend": false
2929+
},
2930+
{
2931+
"datasource": {
2932+
"type": "prometheus",
2933+
"uid": "prometheus"
2934+
},
2935+
"editorMode": "code",
2936+
"expr": "floor(increase(aligned_aggregator_received_tasks_count{bot=\"aggregator\"}[$__range]))",
2937+
"hide": false,
2938+
"instant": false,
2939+
"legendFormat": "Tasks Received",
2940+
"range": true,
2941+
"refId": "B"
2942+
}
2943+
],
2944+
"title": "# Operator Responses",
2945+
"transformations": [
2946+
{
2947+
"id": "reduce",
2948+
"options": {
2949+
"labelsToFields": false,
2950+
"reducers": [
2951+
"lastNotNull"
2952+
]
2953+
}
2954+
},
2955+
{
2956+
"id": "sortBy",
2957+
"options": {
2958+
"fields": {},
2959+
"sort": [
2960+
{
2961+
"desc": false,
2962+
"field": "Last *"
28342963
}
28352964
]
28362965
}
@@ -2847,7 +2976,7 @@
28472976
"h": 2,
28482977
"w": 24,
28492978
"x": 0,
2850-
"y": 69
2979+
"y": 77
28512980
},
28522981
"id": 46,
28532982
"options": {
@@ -2922,7 +3051,7 @@
29223051
"h": 8,
29233052
"w": 12,
29243053
"x": 0,
2925-
"y": 71
3054+
"y": 79
29263055
},
29273056
"id": 47,
29283057
"options": {
@@ -3022,7 +3151,7 @@
30223151
"h": 8,
30233152
"w": 12,
30243153
"x": 12,
3025-
"y": 71
3154+
"y": 79
30263155
},
30273156
"id": 43,
30283157
"interval": "1s",
@@ -3102,8 +3231,7 @@
31023231
"mode": "absolute",
31033232
"steps": [
31043233
{
3105-
"color": "green",
3106-
"value": null
3234+
"color": "green"
31073235
},
31083236
{
31093237
"color": "red",
@@ -3119,7 +3247,7 @@
31193247
"h": 8,
31203248
"w": 12,
31213249
"x": 0,
3122-
"y": 79
3250+
"y": 87
31233251
},
31243252
"id": 45,
31253253
"options": {
@@ -3234,8 +3362,7 @@
32343362
"mode": "absolute",
32353363
"steps": [
32363364
{
3237-
"color": "green",
3238-
"value": null
3365+
"color": "green"
32393366
},
32403367
{
32413368
"color": "red",
@@ -3250,7 +3377,7 @@
32503377
"h": 8,
32513378
"w": 12,
32523379
"x": 12,
3253-
"y": 79
3380+
"y": 87
32543381
},
32553382
"id": 44,
32563383
"interval": "1s",
@@ -3293,7 +3420,7 @@
32933420
"list": []
32943421
},
32953422
"time": {
3296-
"from": "now-30m",
3423+
"from": "now-1h",
32973424
"to": "now"
32983425
},
32993426
"timepicker": {},

telemetry_api/lib/telemetry_api/prometheus_metrics.ex

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ defmodule TelemetryApi.PrometheusMetrics do
33

44
@gauge [name: :gas_price, help: "Ethereum Gas Price.", labels: []]
55
@counter [name: :missing_operator_count, help: "Missing Operators", labels: [:operator]]
6+
@counter [name: :operator_response_count, help: "Operator Response Count", labels: [:operator]]
67

78
def new_gas_price(gas_price) do
89
Gauge.set(
@@ -18,6 +19,13 @@ defmodule TelemetryApi.PrometheusMetrics do
1819
)
1920
end
2021

22+
def operator_response(operator) do
23+
Counter.inc(
24+
name: :operator_response_count,
25+
labels: [operator]
26+
)
27+
end
28+
2129
def initialize_operator_metrics(operator) do
2230
value =
2331
Counter.value(
@@ -30,6 +38,11 @@ defmodule TelemetryApi.PrometheusMetrics do
3038
[name: :missing_operator_count, labels: [operator]],
3139
0
3240
)
41+
42+
Counter.inc(
43+
[name: :operator_response_count, labels: [operator]],
44+
0
45+
)
3346
end
3447
end
3548
end

telemetry_api/lib/telemetry_api/traces.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ defmodule TelemetryApi.Traces do
9191
current_stake: new_stake
9292
})
9393

94+
PrometheusMetrics.operator_response(
95+
operator.name <> " - " <> String.slice(operator.address, 0..7)
96+
)
97+
9498
IO.inspect(
9599
"Operator response included. merkle_root: #{IO.inspect(merkle_root)} operator_id: #{IO.inspect(operator_id)}"
96100
)

0 commit comments

Comments
 (0)