Skip to content

Commit

Permalink
add Prometheus + Grafana for Guardian metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
justinschuldt authored and evan-gray committed Aug 4, 2022
1 parent 126c9dc commit 2c52f86
Show file tree
Hide file tree
Showing 3 changed files with 683 additions and 33 deletions.
43 changes: 43 additions & 0 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ config.define_bool("e2e", False, "Enable E2E testing stack")
config.define_bool("ci_tests", False, "Enable tests runner component")
config.define_bool("bridge_ui_hot", False, "Enable hot loading bridge_ui")
config.define_bool("guardiand_debug", False, "Enable dlv endpoint for guardiand")
config.define_bool("node_metrics", False, "Enable Prometheus & Grafana for Guardian metrics")

cfg = config.parse()
num_guardians = int(cfg.get("num", "1"))
Expand All @@ -69,6 +70,7 @@ spy_relayer = cfg.get("spy_relayer", ci)
e2e = cfg.get("e2e", ci)
ci_tests = cfg.get("ci_tests", ci)
guardiand_debug = cfg.get("guardiand_debug", False)
node_metrics = cfg.get("node_metrics", False)

bridge_ui_hot = not ci

Expand Down Expand Up @@ -260,6 +262,47 @@ if num_guardians >= 2 and ci == False:
trigger_mode = trigger_mode,
)


# grafana + prometheus for node metrics
if node_metrics:

dashboard = read_json("dashboards/Wormhole.json")

dashboard_yaml = {
"apiVersion": "v1",
"kind": "ConfigMap",
"metadata": {
"name": "grafana-dashboards-json"
},
"data": {
"wormhole.json": encode_json(dashboard)
}
}
k8s_yaml_with_ns(encode_yaml(dashboard_yaml))

k8s_yaml_with_ns("devnet/node-metrics.yaml")

k8s_resource(
"prometheus-server",
resource_deps = ["guardian"],
port_forwards = [
port_forward(9099, name = "Prometheus [:9099]", host = webHost),
],
labels = ["guardian"],
trigger_mode = trigger_mode,
)

k8s_resource(
"grafana",
resource_deps = ["prometheus-server"],
port_forwards = [
port_forward(3033, name = "Grafana UI [:3033]", host = webHost),
],
labels = ["guardian"],
trigger_mode = trigger_mode,
)


# spy
k8s_yaml_with_ns("devnet/spy.yaml")

Expand Down
60 changes: 27 additions & 33 deletions dashboards/Wormhole.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
{
"__inputs": [
{
"name": "DS_MAIN_PROMETHEUS",
"label": "Main Prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__inputs": [],
"__requires": [
{
"type": "grafana",
Expand Down Expand Up @@ -39,7 +30,10 @@
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"datasource": {
"type": "datasource",
"uid": "grafana"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
Expand All @@ -60,7 +54,7 @@
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
Expand Down Expand Up @@ -159,7 +153,7 @@
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
Expand Down Expand Up @@ -257,7 +251,7 @@
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
Expand Down Expand Up @@ -355,7 +349,7 @@
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
Expand Down Expand Up @@ -454,7 +448,7 @@
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
Expand Down Expand Up @@ -553,7 +547,7 @@
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
Expand Down Expand Up @@ -652,7 +646,7 @@
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
Expand Down Expand Up @@ -751,7 +745,7 @@
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
Expand Down Expand Up @@ -850,7 +844,7 @@
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
Expand Down Expand Up @@ -978,7 +972,7 @@
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
Expand Down Expand Up @@ -1076,7 +1070,7 @@
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
Expand Down Expand Up @@ -1195,7 +1189,7 @@
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
Expand Down Expand Up @@ -1293,7 +1287,7 @@
"bars": true,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
Expand Down Expand Up @@ -1405,7 +1399,7 @@
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
Expand Down Expand Up @@ -1507,7 +1501,7 @@
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
Expand Down Expand Up @@ -1609,7 +1603,7 @@
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
Expand Down Expand Up @@ -1719,7 +1713,7 @@
"mode": "spectrum"
},
"dataFormat": "timeseries",
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
Expand Down Expand Up @@ -1789,7 +1783,7 @@
"mode": "spectrum"
},
"dataFormat": "timeseries",
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
Expand Down Expand Up @@ -1859,7 +1853,7 @@
"mode": "spectrum"
},
"dataFormat": "timeseries",
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
Expand Down Expand Up @@ -1929,7 +1923,7 @@
"mode": "spectrum"
},
"dataFormat": "timeseries",
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
Expand Down Expand Up @@ -1996,7 +1990,7 @@
{
"allValue": null,
"current": {},
"datasource": "${DS_MAIN_PROMETHEUS}",
"datasource": "prometheus",
"definition": "label_values(wormhole_network_node_height, instance)",
"error": null,
"hide": 0,
Expand Down Expand Up @@ -2027,4 +2021,4 @@
"title": "Wormhole v2",
"uid": "-GcztLMnz",
"version": 16
}
}
Loading

0 comments on commit 2c52f86

Please sign in to comment.