From 5db662b03a5dd3edc1f8f8c64e74356fe09fd5e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20P=C3=A9rez?= Date: Wed, 8 Jan 2025 14:07:32 +0100 Subject: [PATCH 1/3] chore(monitoring): remove the create-dashboard subcommand --- Cargo.lock | 7 -- bin/trin/src/cli.rs | 88 +------------------ ethportal-api/Cargo.toml | 1 - ethportal-api/src/dashboard/grafana.rs | 112 ------------------------- ethportal-api/src/dashboard/mod.rs | 1 - ethportal-api/src/lib.rs | 1 - 6 files changed, 1 insertion(+), 209 deletions(-) delete mode 100644 ethportal-api/src/dashboard/grafana.rs delete mode 100644 ethportal-api/src/dashboard/mod.rs diff --git a/Cargo.lock b/Cargo.lock index 2b488aab2..e1481e6c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2213,7 +2213,6 @@ dependencies = [ "jsonrpsee", "keccak-hash", "lazy_static", - "nanotemplate", "once_cell", "quickcheck", "rand", @@ -3815,12 +3814,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fafa6961cabd9c63bcd77a45d7e3b7f3b552b70417831fb0f56db717e72407e" -[[package]] -name = "nanotemplate" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f247bfe894f8a04e0d8b1eb5eed9dfb7424f6dda47cf83e3f03670e87cb2831b" - [[package]] name = "native-tls" version = "0.2.12" diff --git a/bin/trin/src/cli.rs b/bin/trin/src/cli.rs index 2473b3f44..bb6dcbabf 100644 --- a/bin/trin/src/cli.rs +++ b/bin/trin/src/cli.rs @@ -5,10 +5,9 @@ use clap::{ arg, builder::ArgPredicate, error::{Error, ErrorKind}, - Args, Parser, Subcommand, + Parser, }; use ethportal_api::{ - dashboard::grafana::{GrafanaAPI, DASHBOARD_TEMPLATES}, types::{ network::Subnetwork, portal_wire::{NetworkSpec, MAINNET}, @@ -206,9 +205,6 @@ pub struct TrinConfig { default_value_t = DEFAULT_UTP_TRANSFER_LIMIT, )] pub utp_transfer_limit: usize, - - #[command(subcommand)] - pub command: Option, } impl Default for TrinConfig { @@ -238,7 +234,6 @@ impl Default for TrinConfig { disable_poke: false, ws: false, ws_port: DEFAULT_WEB3_WS_PORT, - command: None, utp_transfer_limit: DEFAULT_UTP_TRANSFER_LIMIT, network: MAINNET.clone(), } @@ -257,14 +252,6 @@ impl TrinConfig { { let config = Self::try_parse_from(args)?; - if let Some(TrinConfigCommands::CreateDashboard(dashboard_config)) = config.command { - if let Err(err) = create_dashboard(dashboard_config) { - panic!("Creating dashboard failed {err}"); - } - // exit program since if the user uses create dashboard this is all we do - std::process::exit(0); - } - match config.web3_transport { Web3TransportType::HTTP => { match &config.web3_ipc_path.as_path().display().to_string()[..] { @@ -416,52 +403,6 @@ impl fmt::Display for TrinConfig { } } -#[derive(Subcommand, Debug, Clone, PartialEq)] -#[allow(clippy::enum_variant_names)] -pub enum TrinConfigCommands { - CreateDashboard(DashboardConfig), -} - -#[derive(Args, Debug, Default, Clone, PartialEq)] -#[allow(clippy::enum_variant_names)] -pub struct DashboardConfig { - #[arg(default_value = "http://localhost:3000")] - pub grafana_address: String, - - #[arg(default_value = "admin")] - pub grafana_username: String, - - #[arg(default_value = "admin")] - pub grafana_password: String, - - #[arg(default_value = "http://host.docker.internal:9090")] - pub prometheus_address: String, -} - -pub fn create_dashboard( - dashboard_config: DashboardConfig, -) -> Result<(), Box> { - let grafana = GrafanaAPI::new( - dashboard_config.grafana_username, - dashboard_config.grafana_password, - dashboard_config.grafana_address, - ); - - let prometheus_uid = grafana.create_datasource( - "prometheus".to_string(), - "prometheus".to_string(), - dashboard_config.prometheus_address, - )?; - - // Create a dashboard from each pre-defined template - for template_path in DASHBOARD_TEMPLATES { - let dashboard_url = grafana.create_dashboard(template_path, &prometheus_uid)?; - println!("Dashboard successfully created: {dashboard_url}"); - } - - Ok(()) -} - impl TrinConfig { pub fn to_portalnet_config(&self, private_key: B256) -> PortalnetConfig { PortalnetConfig { @@ -715,33 +656,6 @@ mod tests { .unwrap(); } - #[test_log::test] - fn test_trin_with_create_dashboard() { - let config = TrinConfig::try_parse_from([ - "trin", - "create-dashboard", - "http://localhost:8787", - "username", - "password", - "http://docker:9090", - ]) - .unwrap(); - if let Some(TrinConfigCommands::CreateDashboard(dashboard_config)) = config.command { - assert_eq!( - dashboard_config.grafana_address, - "http://localhost:8787".to_string() - ); - assert_eq!(dashboard_config.grafana_username, "username".to_string()); - assert_eq!(dashboard_config.grafana_password, "password".to_string()); - assert_eq!( - dashboard_config.prometheus_address, - "http://docker:9090".to_string() - ); - } else { - unreachable!("") - } - } - #[test_log::test] #[should_panic(expected = "Invalid web3-transport arg. Expected either 'http' or 'ipc'")] fn test_invalid_web3_transport_argument() { diff --git a/ethportal-api/Cargo.toml b/ethportal-api/Cargo.toml index 5c7c380fb..b9d459407 100644 --- a/ethportal-api/Cargo.toml +++ b/ethportal-api/Cargo.toml @@ -31,7 +31,6 @@ hex.workspace = true jsonrpsee = { workspace = true, features = ["async-client", "client", "macros", "server"]} keccak-hash.workspace = true lazy_static.workspace = true -nanotemplate = "0.3.0" once_cell = "1.17" quickcheck.workspace = true rand.workspace = true diff --git a/ethportal-api/src/dashboard/grafana.rs b/ethportal-api/src/dashboard/grafana.rs deleted file mode 100644 index 318120727..000000000 --- a/ethportal-api/src/dashboard/grafana.rs +++ /dev/null @@ -1,112 +0,0 @@ -use std::fs; - -use base64; -use nanotemplate::template; -use serde::Deserialize; -use ureq; - -pub const DASHBOARD_TEMPLATES: &[&str] = - &["./etc/grafana/dashboards/collected-metrics-dashboard.json.template"]; - -pub struct GrafanaAPI { - basic_auth_string: String, - address: String, -} - -// todo: automatically update datasource/dashboard via `create-dashboard` command -// rather than deleting and recreating them -impl GrafanaAPI { - pub fn new(username: String, password: String, address: String) -> Self { - let basic_auth_string = format!("{username}:{password}"); - let basic_auth_string = base64::encode(basic_auth_string); - let basic_auth_string = format!("Basic {basic_auth_string}"); - - Self { - basic_auth_string, - address, - } - } - - pub fn create_datasource( - &self, - datasource_type: String, - name: String, - url: String, - ) -> Result { - let datasource_api_url = format!("{}/{}", self.address, "api/datasources/"); - - // If this fails with a 409 error, it's because the datasource already exists. - // Delete it and try again. - let datasource_creation_response = ureq::post(&datasource_api_url) - .set("Authorization", &self.basic_auth_string) - .send_json(ureq::json!({ - "name": name, - "type": datasource_type, - "access": "proxy", - "url": url, - "basicAuth": false, - }))?; - let response: DatasourceCreationResponse = datasource_creation_response.into_json()?; - Ok(response.datasource.uid) - } - - pub fn create_dashboard( - &self, - template_path: &str, - prometheus_uid: &str, - ) -> Result { - let filled_in_template = - GrafanaAPI::interpolate_dashboard_config(template_path, prometheus_uid)?; - let dashboard_json: serde_json::Value = serde_json::from_str(&filled_in_template[..])?; - - let dashboard_api_url = format!("{}/{}", self.address, "api/dashboards/db/"); - - // If this is failing with a 409 error, it means that there is likely a problem with the - // template, make sure that ... - // - All "uid" fields inside a prometheus datasource object contain `"uid": - // "{prometheus_id}"` - // - The root level `"id"` field is set to `null` (`"id": null`) - // - The root level `"title"` field is set to "Trin Metrics" (`"title": "Trin Metrics"`) - // - The root level `"uid"` field is set to "trin-metrics" (`"uid": "trin-metrics"`) - let dashboard_creation_response: DashboardCreationResponse = ureq::post(&dashboard_api_url) - .set("Authorization", &self.basic_auth_string) - .send_json(ureq::json!({ "dashboard": dashboard_json }))? - .into_json()?; - - let full_dashboard_url = format!("{}{}", self.address, dashboard_creation_response.url); - Ok(full_dashboard_url) - } - - fn interpolate_dashboard_config( - template_path: &str, - prometheus_uid: &str, - ) -> Result { - // Open the metrics dashboard and fill in the prometheus uid - let template_string = fs::read_to_string(template_path)?; - let populated_template = template( - &template_string[..], - [ - ("prometheus_uid", prometheus_uid), - ("", "{}"), /* The templating library picks up an empty json object as a - * placeholder, so replace it with - * another empty json object. */ - ], - )?; - Ok(populated_template) - } -} - -// Structs representing responses to API calls -#[derive(Deserialize)] -struct DatasourceCreationResponse { - datasource: DatasourceInfo, -} -#[derive(Deserialize)] -struct DatasourceInfo { - uid: String, -} - -#[derive(Deserialize)] -struct DashboardCreationResponse { - url: String, -} diff --git a/ethportal-api/src/dashboard/mod.rs b/ethportal-api/src/dashboard/mod.rs deleted file mode 100644 index 85443dfb1..000000000 --- a/ethportal-api/src/dashboard/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod grafana; diff --git a/ethportal-api/src/lib.rs b/ethportal-api/src/lib.rs index 56f5e4a85..6d9ffaf2d 100644 --- a/ethportal-api/src/lib.rs +++ b/ethportal-api/src/lib.rs @@ -7,7 +7,6 @@ extern crate lazy_static; mod beacon; -pub mod dashboard; pub mod discv5; mod eth; mod history; From 2df5ba1b95d642d1c6fcff76aa4a1a2fa5b1e46d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20P=C3=A9rez?= Date: Thu, 9 Jan 2025 20:31:21 +0100 Subject: [PATCH 2/3] chore(monitoring): setup Grafana provisioning --- etc/README.md | 8 - metrics/README.md | 25 + metrics/compose.yaml | 22 + metrics/grafana/dashboard.yaml | 8 + ...bench-trin-metrics-dashboard.json.template | 0 .../grafana/dashboards/trin-metrics.json | 1094 ++++------------- metrics/grafana/datasource.yaml | 11 + {etc => metrics}/prometheus/prometheus.yml | 4 +- 8 files changed, 308 insertions(+), 864 deletions(-) delete mode 100644 etc/README.md create mode 100644 metrics/README.md create mode 100644 metrics/compose.yaml create mode 100644 metrics/grafana/dashboard.yaml rename {etc => metrics}/grafana/dashboards/trin-bench-trin-metrics-dashboard.json.template (100%) rename etc/grafana/dashboards/collected-metrics-dashboard.json.template => metrics/grafana/dashboards/trin-metrics.json (72%) create mode 100644 metrics/grafana/datasource.yaml rename {etc => metrics}/prometheus/prometheus.yml (84%) diff --git a/etc/README.md b/etc/README.md deleted file mode 100644 index 204049daa..000000000 --- a/etc/README.md +++ /dev/null @@ -1,8 +0,0 @@ -## Miscellaneous - -This directory contains miscellaneous files, such as Grafana dashboards and Prometheus configuration. - -### Overview - -- [**Prometheus**](./prometheus/prometheus.yml): An example Prometheus configuration. -- [**Grafana**](./grafana/): Example Grafana dashboards diff --git a/metrics/README.md b/metrics/README.md new file mode 100644 index 000000000..6144c37cd --- /dev/null +++ b/metrics/README.md @@ -0,0 +1,25 @@ +# Trin Metrics + +You can run this docker compose file it will run +- prometheus +- grafana +- setup the metrics dashboard + +Metrics are useful for telling how Trin is performing. + +The default username and password is `admin`. + +### How to run +```sh +docker compose up +``` + +### View the dashboard at +http://localhost:3000/d/trin-metrics/trin-metrics + +***WARNING***: don't forget to run `Trin` with metric exporting on! + +**Example** +```bash +cargo run -p trin -- --enable-metrics-with-url 0.0.0.0:9100 --web3-http-address http://0.0.0.0:8545 --web3-transport http +``` diff --git a/metrics/compose.yaml b/metrics/compose.yaml new file mode 100644 index 000000000..5ba838e9f --- /dev/null +++ b/metrics/compose.yaml @@ -0,0 +1,22 @@ +services: + prometheus: + image: prom/prometheus + container_name: prometheus + command: + - '--config.file=/etc/prometheus/prometheus.yml' + network_mode: "host" + restart: unless-stopped + volumes: + - ./prometheus:/etc/prometheus + - prom_data_trin:/prometheus + grafana: + image: grafana/grafana + container_name: grafana + network_mode: "host" + restart: unless-stopped + volumes: + - ./grafana/datasource.yaml:/etc/grafana/provisioning/datasources/datasource.yaml + - ./grafana/dashboard.yaml:/etc/grafana/provisioning/dashboards/main.yaml + - ./grafana/dashboards:/var/lib/grafana/dashboards +volumes: + prom_data_trin: diff --git a/metrics/grafana/dashboard.yaml b/metrics/grafana/dashboard.yaml new file mode 100644 index 000000000..81180d37a --- /dev/null +++ b/metrics/grafana/dashboard.yaml @@ -0,0 +1,8 @@ +apiVersion: 1 + +providers: +- name: 'Trin' + orgId: 1 + type: file + options: + path: /var/lib/grafana/dashboards diff --git a/etc/grafana/dashboards/trin-bench-trin-metrics-dashboard.json.template b/metrics/grafana/dashboards/trin-bench-trin-metrics-dashboard.json.template similarity index 100% rename from etc/grafana/dashboards/trin-bench-trin-metrics-dashboard.json.template rename to metrics/grafana/dashboards/trin-bench-trin-metrics-dashboard.json.template diff --git a/etc/grafana/dashboards/collected-metrics-dashboard.json.template b/metrics/grafana/dashboards/trin-metrics.json similarity index 72% rename from etc/grafana/dashboards/collected-metrics-dashboard.json.template rename to metrics/grafana/dashboards/trin-metrics.json index 1d317fc6b..8bc949610 100644 --- a/etc/grafana/dashboards/collected-metrics-dashboard.json.template +++ b/metrics/grafana/dashboards/trin-metrics.json @@ -26,14 +26,9 @@ "graphTooltip": 0, "id": 2, "links": [], - "liveNow": false, "panels": [ { "collapsed": false, - "datasource": { - "type": "datasource", - "uid": "grafana" - }, "gridPos": { "h": 1, "w": 24, @@ -42,22 +37,13 @@ }, "id": 38, "panels": [], - "targets": [ - { - "datasource": { - "type": "datasource", - "uid": "grafana" - }, - "refId": "A" - } - ], "title": "Content Validation", "type": "row" }, { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -71,6 +57,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -109,8 +96,7 @@ "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -133,39 +119,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "sum(trin_validation_total{protocol=\"History\", success=\"false\"})", + "expr": "trin_validation_total{success=\"false\"}", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "sum(trin_validation_total{protocol=\"Beacon\", success=\"false\"})", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Failed Validations", @@ -174,7 +144,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -188,6 +158,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -226,8 +197,7 @@ "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [ { @@ -236,9 +206,7 @@ "id": "byNames", "options": { "mode": "exclude", - "names": [ - "Value" - ], + "names": ["Value"], "prefix": "All except:", "readOnly": true } @@ -275,40 +243,24 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "sum(trin_validation_total{protocol=\"History\", success=\"true\"})", + "expr": "trin_validation_total{success=\"true\"}", "fullMetaSearch": false, "hide": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "sum(trin_validation_total{protocol=\"Beacon\", success=\"true\"})", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Successful Validations", @@ -316,10 +268,6 @@ }, { "collapsed": false, - "datasource": { - "type": "datasource", - "uid": "grafana" - }, "gridPos": { "h": 1, "w": 24, @@ -328,22 +276,13 @@ }, "id": 25, "panels": [], - "targets": [ - { - "datasource": { - "type": "datasource", - "uid": "grafana" - }, - "refId": "A" - } - ], "title": "uTP", "type": "row" }, { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -357,6 +296,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -395,8 +335,7 @@ "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -419,39 +358,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "trin_utp_active_streams{direction=\"inbound\", protocol=\"History\"}", + "expr": "trin_utp_active_streams{direction=\"inbound\"}", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "sum(trin_utp_active_streams{direction=\"inbound\", protocol=\"Beacon\"})", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "uTP Active Streams (Inbound)", @@ -460,7 +383,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -474,6 +397,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -512,8 +436,7 @@ "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -536,39 +459,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "trin_utp_active_streams{direction=\"outbound\", protocol=\"History\"}", + "expr": "trin_utp_active_streams{direction=\"outbound\"}", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "trin_utp_active_streams{direction=\"outbound\", protocol=\"Beacon\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "uTP Active Streams (Outbound)", @@ -577,7 +484,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -591,6 +498,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -629,8 +537,7 @@ "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -653,39 +560,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "trin_utp_outcome_total{outcome=\"failed data tx\", protocol=\"History\", direction=\"inbound\"}", + "expr": "trin_utp_outcome_total{outcome=\"failed data tx\", direction=\"inbound\"}", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "trin_utp_outcome_total{outcome=\"failed data tx\", protocol=\"Beacon\", direction=\"inbound\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Utp Outcome: Failed Data Tx (Inbound)", @@ -694,7 +585,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -708,6 +599,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -746,8 +638,7 @@ "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -770,39 +661,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "trin_utp_outcome_total{direction=\"outbound\", outcome=\"failed data tx\", protocol=\"History\"}", + "expr": "trin_utp_outcome_total{direction=\"outbound\", outcome=\"failed data tx\"}", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "trin_utp_outcome_total{direction=\"outbound\", outcome=\"failed data tx\", protocol=\"Beacon\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Utp Outcome: Failed Data Tx (Outbound)", @@ -811,7 +686,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -825,6 +700,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -855,16 +731,14 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -887,39 +761,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "trin_utp_outcome_total{direction=\"inbound\", outcome=\"failed shutdown\", protocol=\"History\"}", + "expr": "trin_utp_outcome_total{direction=\"inbound\", outcome=\"failed shutdown\"}", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "trin_utp_outcome_total{direction=\"inbound\", outcome=\"failed shutdown\", protocol=\"Beacon\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Utp Outcome: Failed Shutdown (Inbound)", @@ -928,7 +786,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -942,6 +800,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -972,16 +831,14 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -1004,39 +861,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "trin_utp_outcome_total{direction=\"outbound\", outcome=\"failed shutdown\", protocol=\"History\"}", + "expr": "trin_utp_outcome_total{direction=\"outbound\", outcome=\"failed shutdown\"}", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "trin_utp_outcome_total{direction=\"outbound\", outcome=\"failed shutdown\", protocol=\"Beacon\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Utp Outcome: Failed Shutdown (Outbound)", @@ -1045,7 +886,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -1059,6 +900,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -1089,16 +931,14 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -1121,39 +961,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "trin_utp_outcome_total{outcome=\"failed connection\", direction=\"inbound\", protocol=\"History\"}", + "expr": "trin_utp_outcome_total{outcome=\"failed connection\", direction=\"inbound\"}", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "trin_utp_outcome_total{outcome=\"failed connection\", direction=\"inbound\", protocol=\"Beacon\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Utp Outcome: Failed Connection (Inbound)", @@ -1162,7 +986,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -1176,6 +1000,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -1206,43 +1031,16 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", "value": 80 } ] - }, - "unitScale": true - }, - "overrides": [ - { - "__systemRef": "hideSeriesFrom", - "matcher": { - "id": "byNames", - "options": { - "mode": "exclude", - "names": [ - "Beacon" - ], - "prefix": "All except:", - "readOnly": true - } - }, - "properties": [ - { - "id": "custom.hideFrom", - "value": { - "legend": false, - "tooltip": false, - "viz": true - } - } - ] } - ] + }, + "overrides": [] }, "gridPos": { "h": 9, @@ -1263,39 +1061,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "trin_utp_outcome_total{direction=\"outbound\", outcome=\"failed connection\", protocol=\"History\"}", + "expr": "trin_utp_outcome_total{direction=\"outbound\", outcome=\"failed connection\"}", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "trin_utp_outcome_total{direction=\"outbound\", outcome=\"failed connection\", protocol=\"Beacon\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Utp Outcome: Failed Connection (Outbound)", @@ -1304,7 +1086,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -1318,6 +1100,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -1348,16 +1131,14 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -1380,39 +1161,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "trin_utp_outcome_total{direction=\"inbound\", outcome=\"success\", protocol=\"History\"}", + "expr": "trin_utp_outcome_total{direction=\"inbound\", outcome=\"success\"}", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "trin_utp_outcome_total{direction=\"inbound\", outcome=\"success\", protocol=\"Beacon\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "uTP Outcome: Success (Inbound)", @@ -1421,7 +1186,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -1435,6 +1200,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -1465,16 +1231,14 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -1497,39 +1261,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "trin_utp_outcome_total{direction=\"outbound\", outcome=\"success\", protocol=\"History\"}", + "expr": "trin_utp_outcome_total{direction=\"outbound\", outcome=\"success\"}", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "trin_utp_outcome_total{direction=\"outbound\", outcome=\"success\", protocol=\"Beacon\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "uTP Outcome: Success (Outbound)", @@ -1537,10 +1285,6 @@ }, { "collapsed": false, - "datasource": { - "type": "datasource", - "uid": "grafana" - }, "gridPos": { "h": 1, "w": 24, @@ -1549,22 +1293,13 @@ }, "id": 19, "panels": [], - "targets": [ - { - "datasource": { - "type": "datasource", - "uid": "grafana" - }, - "refId": "A" - } - ], "title": "Messages", "type": "row" }, { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -1578,6 +1313,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -1608,16 +1344,14 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -1640,39 +1374,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"received\", type=\"ping\", protocol=\"History\"}[$__rate_interval])", + "expr": "rate(trin_message_total{direction=\"received\", type=\"ping\"}[$__rate_interval])", "fullMetaSearch": false, "includeNullMetadata": false, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"received\", type=\"ping\", protocol=\"Beacon\"}[$__rate_interval])", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Total Inbound PING", @@ -1681,7 +1399,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -1695,6 +1413,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -1725,16 +1444,14 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -1757,39 +1474,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"sent\", type=\"ping\", protocol=\"History\"}[$__rate_interval])", + "expr": "sum by(protocol) (rate(trin_message_total{direction=\"sent\", type=\"ping\"}[$__rate_interval]))", "fullMetaSearch": false, "includeNullMetadata": false, "instant": false, - "legendFormat": "History", + "legendFormat": "__auto", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"sent\", type=\"ping\", protocol=\"Beacon\"}[$__rate_interval])", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Total Outbound PING", @@ -1798,7 +1499,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -1812,6 +1513,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -1842,16 +1544,14 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -1874,39 +1574,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"received\", type=\"pong\", protocol=\"History\"}[$__rate_interval])", + "expr": "rate(trin_message_total{direction=\"received\", type=\"pong\"}[$__rate_interval])", "fullMetaSearch": false, "includeNullMetadata": false, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"received\", type=\"pong\", protocol=\"Beacon\"}[$__rate_interval])", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Total Inbound PONG", @@ -1915,7 +1599,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -1929,6 +1613,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -1959,16 +1644,14 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -1991,39 +1674,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"sent\", type=\"pong\", protocol=\"History\"}[$__rate_interval])", + "expr": "rate(trin_message_total{direction=\"sent\", type=\"pong\"}[$__rate_interval])", "fullMetaSearch": false, "includeNullMetadata": false, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"sent\", type=\"pong\", protocol=\"Beacon\"}[$__rate_interval])", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Total Outbound PONG", @@ -2032,7 +1699,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -2046,6 +1713,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -2076,16 +1744,14 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -2108,39 +1774,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"received\", type=\"find_nodes\", protocol=\"History\"}[$__rate_interval])", + "expr": "rate(trin_message_total{direction=\"received\", type=\"find_nodes\"}[$__rate_interval])", "fullMetaSearch": false, "includeNullMetadata": false, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"received\", type=\"find_nodes\", protocol=\"Beacon\"}[$__rate_interval])", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Total Inbound FINDNODES", @@ -2149,7 +1799,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -2163,6 +1813,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -2193,16 +1844,14 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -2225,39 +1874,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"sent\", type=\"find_nodes\", protocol=\"History\"}[$__rate_interval])", + "expr": "sum by(protocol) (rate(trin_message_total{direction=\"sent\", type=\"find_nodes\"}[$__rate_interval]))", "fullMetaSearch": false, "includeNullMetadata": false, "instant": false, - "legendFormat": "History", + "legendFormat": "__auto", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"sent\", type=\"find_nodes\", protocol=\"Beacon\"}[$__rate_interval])", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Total Outbound FINDNODES", @@ -2266,7 +1899,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -2280,6 +1913,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -2310,16 +1944,14 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -2342,39 +1974,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"received\", type=\"nodes\", protocol=\"History\"}[$__rate_interval])", + "expr": "rate(trin_message_total{direction=\"received\", type=\"nodes\"}[$__rate_interval])", "fullMetaSearch": false, "includeNullMetadata": false, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"received\", type=\"nodes\", protocol=\"Beacon\"}[$__rate_interval])", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Total Inbound NODES", @@ -2383,7 +1999,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -2397,6 +2013,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -2427,16 +2044,14 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -2459,39 +2074,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"sent\", type=\"nodes\", protocol=\"History\"}[$__rate_interval])", + "expr": "rate(trin_message_total{direction=\"sent\", type=\"nodes\"}[$__rate_interval])", "fullMetaSearch": false, "includeNullMetadata": false, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"sent\", type=\"nodes\", protocol=\"Beacon\"}[$__rate_interval])", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Total Outbound NODES", @@ -2500,7 +2099,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -2514,6 +2113,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -2544,43 +2144,16 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", "value": 80 } ] - }, - "unitScale": true - }, - "overrides": [ - { - "__systemRef": "hideSeriesFrom", - "matcher": { - "id": "byNames", - "options": { - "mode": "exclude", - "names": [ - "trin-ams3-11" - ], - "prefix": "All except:", - "readOnly": true - } - }, - "properties": [ - { - "id": "custom.hideFrom", - "value": { - "legend": false, - "tooltip": false, - "viz": true - } - } - ] } - ] + }, + "overrides": [] }, "gridPos": { "h": 8, @@ -2601,39 +2174,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"received\", type=\"find_content\", protocol=\"History\"}[$__rate_interval])", + "expr": "rate(trin_message_total{direction=\"received\", type=\"find_content\"}[$__rate_interval])", "fullMetaSearch": false, "includeNullMetadata": false, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"received\", type=\"find_content\", protocol=\"Beacon\"}[$__rate_interval])", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Total Inbound FINDCONTENT", @@ -2642,7 +2199,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -2656,6 +2213,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -2686,16 +2244,14 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -2718,39 +2274,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"sent\", type=\"find_content\", protocol=\"History\"}[$__rate_interval])", + "expr": "sum by(protocol) (rate(trin_message_total{direction=\"sent\", type=\"find_content\"}[$__rate_interval]))", "fullMetaSearch": false, "includeNullMetadata": false, "instant": false, - "legendFormat": "History", + "legendFormat": "__auto", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"sent\", type=\"find_content\", protocol=\"Beacon\"}[$__rate_interval])", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Total Outbound FINDCONTENT", @@ -2759,7 +2299,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -2773,6 +2313,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -2803,16 +2344,14 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -2835,39 +2374,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"received\", type=\"content\", protocol=\"History\"}[$__rate_interval])", + "expr": "sum by(protocol) (rate(trin_message_total{direction=\"received\", type=\"content\"}[$__rate_interval]))", "fullMetaSearch": false, "includeNullMetadata": false, "instant": false, - "legendFormat": "History", + "legendFormat": "__auto", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"received\", type=\"content\", protocol=\"Beacon\"}[$__rate_interval])", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Total Inbound CONTENT", @@ -2876,7 +2399,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -2890,6 +2413,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -2920,16 +2444,14 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -2952,39 +2474,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"sent\", type=\"content\", protocol=\"History\"}[$__rate_interval])", + "expr": "rate(trin_message_total{direction=\"sent\", type=\"content\"}[$__rate_interval])", "fullMetaSearch": false, "includeNullMetadata": false, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "rate(trin_message_total{direction=\"sent\", type=\"content\", protocol=\"Beacon\"}[$__rate_interval])", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Total Outbound CONTENT", @@ -2992,10 +2498,6 @@ }, { "collapsed": false, - "datasource": { - "type": "datasource", - "uid": "grafana" - }, "gridPos": { "h": 1, "w": 24, @@ -3004,22 +2506,13 @@ }, "id": 17, "panels": [], - "targets": [ - { - "datasource": { - "type": "datasource", - "uid": "grafana" - }, - "refId": "A" - } - ], "title": "Storage", "type": "row" }, { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "description": "total number of storage entries", "fieldConfig": { @@ -3034,6 +2527,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -3064,8 +2558,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -3073,7 +2566,7 @@ } ] }, - "unitScale": true + "unit": "sishort" }, "overrides": [] }, @@ -3096,39 +2589,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "trin_entry_count{protocol=\"History\"}", + "expr": "trin_entry_count", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "trin_entry_count{protocol=\"Beacon\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Entry Count", @@ -3137,7 +2614,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "description": "the fraction of the whole data ring covered by the data radius", "fieldConfig": { @@ -3152,6 +2629,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -3182,16 +2660,14 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", "value": 80 } ] - }, - "unitScale": true + } }, "overrides": [] }, @@ -3214,39 +2690,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "trin_radius_ratio{protocol=\"History\"}", + "expr": "trin_radius_ratio", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "trin_radius_ratio{protocol=\"Beacon\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Radius Ratio", @@ -3255,7 +2715,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "description": "sum of size of individual content stored, in bytes", "fieldConfig": { @@ -3270,6 +2730,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -3300,8 +2761,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -3309,8 +2769,7 @@ } ] }, - "unit": "decbytes", - "unitScale": true + "unit": "decbytes" }, "overrides": [] }, @@ -3333,39 +2792,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "trin_content_storage_usage_bytes{protocol=\"History\"}", + "expr": "trin_content_storage_usage_bytes", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "trin_content_storage_usage_bytes{protocol=\"Beacon\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Content Storage Usage", @@ -3374,7 +2817,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "description": "full on-disk database size, in bytes", "fieldConfig": { @@ -3389,6 +2832,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -3419,8 +2863,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -3428,8 +2871,7 @@ } ] }, - "unit": "decbytes", - "unitScale": true + "unit": "decbytes" }, "overrides": [] }, @@ -3452,39 +2894,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "trin_total_storage_usage_bytes{protocol=\"History\"}", + "expr": "trin_total_storage_usage_bytes", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "trin_total_storage_usage_bytes{protocol=\"Beacon\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Total Storage Usage", @@ -3493,7 +2919,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "description": "user-defined limit on storage usage", "fieldConfig": { @@ -3508,6 +2934,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -3538,8 +2965,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -3547,35 +2973,9 @@ } ] }, - "unit": "decbytes", - "unitScale": true + "unit": "decbytes" }, - "overrides": [ - { - "__systemRef": "hideSeriesFrom", - "matcher": { - "id": "byNames", - "options": { - "mode": "exclude", - "names": [ - "trin-ams3-10-History" - ], - "prefix": "All except:", - "readOnly": true - } - }, - "properties": [ - { - "id": "custom.hideFrom", - "value": { - "legend": false, - "tooltip": false, - "viz": true - } - } - ] - } - ] + "overrides": [] }, "gridPos": { "h": 8, @@ -3596,39 +2996,23 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "trin_storage_capacity_bytes{protocol=\"History\"}", + "expr": "trin_storage_capacity_bytes", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "History", + "legendFormat": "{{protocol}}", "range": true, "refId": "A", "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "{prometheus_uid}" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "trin_storage_capacity_bytes{protocol=\"Beacon\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Beacon", - "range": true, - "refId": "B", - "useBackend": false } ], "title": "Storage Capacity", @@ -3637,7 +3021,7 @@ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "fieldConfig": { "defaults": { @@ -3651,6 +3035,7 @@ "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, + "barWidthFactor": 0.6, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", @@ -3681,13 +3066,11 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] }, - "unit": "s", - "unitScale": true + "unit": "s" }, "overrides": [] }, @@ -3710,15 +3093,16 @@ "sort": "none" } }, + "pluginVersion": "11.4.0", "targets": [ { "datasource": { "type": "prometheus", - "uid": "{prometheus_uid}" + "uid": "trinprom" }, "disableTextWrap": false, "editorMode": "code", - "expr": "rate(trin_storage_process_timer_sum[1m])/rate(trin_storage_process_timer_count[1m])", + "expr": "rate(trin_storage_process_timer_sum[$__rate_interval])/rate(trin_storage_process_timer_count[$__rate_interval])", "fullMetaSearch": false, "hide": false, "includeNullMetadata": true, @@ -3740,13 +3124,13 @@ "list": [] }, "time": { - "from": "now-15m", + "from": "now-6h", "to": "now" }, "timepicker": {}, "timezone": "", "title": "Trin Metrics", "uid": "trin-metrics", - "version": 2, + "version": 1, "weekStart": "" } diff --git a/metrics/grafana/datasource.yaml b/metrics/grafana/datasource.yaml new file mode 100644 index 000000000..7de1b318c --- /dev/null +++ b/metrics/grafana/datasource.yaml @@ -0,0 +1,11 @@ +apiVersion: 1 + +datasources: +- name: Prometheus + type: prometheus + uid: trinprom + url: http://localhost:9090 + orgId: 1 + access: proxy + isDefault: true + diff --git a/etc/prometheus/prometheus.yml b/metrics/prometheus/prometheus.yml similarity index 84% rename from etc/prometheus/prometheus.yml rename to metrics/prometheus/prometheus.yml index 2f972253c..296f7315b 100644 --- a/etc/prometheus/prometheus.yml +++ b/metrics/prometheus/prometheus.yml @@ -12,7 +12,7 @@ alerting: static_configs: - targets: [] scrape_configs: -- job_name: prometheus +- job_name: trin honor_timestamps: true scrape_interval: 15s scrape_timeout: 10s @@ -20,6 +20,8 @@ scrape_configs: scheme: http follow_redirects: true enable_http2: true + fallback_scrape_protocol: PrometheusText0.0.4 static_configs: - targets: + - localhost:9100 - host.docker.internal:9100 From b34d31b31ac25f34db544626c95084853faf72bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20P=C3=A9rez?= Date: Thu, 9 Jan 2025 20:32:04 +0100 Subject: [PATCH 3/3] docs(monitoring): use grafana provisioning --- book/src/users/monitoring.md | 262 ++--------------------------------- 1 file changed, 9 insertions(+), 253 deletions(-) diff --git a/book/src/users/monitoring.md b/book/src/users/monitoring.md index 256bb2ed1..cccb86c3e 100644 --- a/book/src/users/monitoring.md +++ b/book/src/users/monitoring.md @@ -39,265 +39,22 @@ htop ``` ## Metrics -[Metrics setup no docker](#metrics-setup-no-docker) +Prometheus maintains a database of metrics. Grafana converts metrics into graphs. -[Metrics setup with docker](#metrics-setup-with-docker) - -## Metrics setup no docker -Prometheus maintains a database of metrics (trin & system). Grafana converts metrics into graphs. Node exporter provides system information. ```mermaid graph TD; Browser-->Grafana-->Prometheus -Prometheus-->Trin & node[Node Exporter] -``` - -### Install prometheus - -Download the latest prometheus [https://prometheus.io/download/](https://prometheus.io/download/) - -```sh -curl -LO -``` -Checksum -```sh -sha256sum -``` -Extract -```sh -tar xvf -``` -The directory will contain the binaries for prometheus and promtool. Copy these. -```sh -cd -sudo cp prometheus /usr/local/bin/ -sudo cp promtool /usr/local/bin/ -``` -Copy the console files -```sh -sudo cp -r consoles /etc/prometheus -sudo cp -r console_libraries /etc/prometheus -``` -Remove the downloaded files -```sh -cd ~ -rm -rm -r -``` -Make a prometheus user -```sh -sudo useradd --no-create-home --shell /bin/false prometheus -``` -Create a prometheus data directory -```sh -sudo mkdir -p /var/lib/prometheus -``` -Make a config file -```sh -sudo nano /etc/prometheus/prometheus.yml +Prometheus-->Trin ``` -Put this in the config file: -```yml -global: - scrape_interval: 15s - evaluation_interval: 15s -alerting: - alertmanagers: - - static_configs: - - targets: -rule_files: +1. [Install Docker](https://docs.docker.com/engine/install/). -scrape_configs: - - job_name: 'node_exporter' - static_configs: - - targets: ['localhost:9100'] - - job_name: 'trin' - static_configs: - - targets: ['localhost:9101'] -``` -The `node_exporter` job will gather system data by listening to port `9100`. -The `trin` job will gather system data by listening to port `9101`. - -Update the permissions -```sh -sudo chown -R prometheus:prometheus /etc/prometheus -sudo chown -R prometheus:prometheus /var/lib/prometheus -``` -Prometheus will use port 9090 by default. Check it is not used by something else: -```sh -sudo lsof -i:9090 -``` -Create a service for prometheus -```sh -sudo nano /etc/systemd/system/prometheus.service -``` -Include the following, pick another port if 9090 is already in use. -```ini -[Unit] -Description=Prometheus -Wants=network-online.target -After=network-online.target - -[Service] -Type=simple -User=prometheus -Group=prometheus -Restart=always -RestartSec=5 -ExecStart=/usr/local/bin/prometheus \ - --config.file /etc/prometheus/prometheus.yml \ - --storage.tsdb.path /var/lib/prometheus/ \ - --web.console.templates=/etc/prometheus/consoles \ - --web.console.libraries=/etc/prometheus/console_libraries \ - --web.listen-address="localhost:9090" -ExecReload=/bin/kill -HUP $MAINPID - -[Install] -WantedBy=multi-user.target -``` -Start the service +2. From the `metrics` directory run: ```sh -sudo systemctl daemon-reload -sudo systemctl start prometheus -sudo systemctl status prometheus -sudo systemctl enable prometheus +docker compose up ``` -### Install node exporter - -Download the latest node exporter [https://prometheus.io/download/#node_exporter](https://prometheus.io/download/#node_exporter) - -```sh -curl -LO -``` -Checksum -```sh -sha256sum -``` -Extract -```sh -tar xvf -``` -The directory will contain the binary for node exporter. Copy this. -```sh -cd -sudo cp node_exporter /usr/local/bin/ -``` -Remove the downloaded files -```sh -cd ~ -rm -rm -r -``` -Make a node_exporter user and give it permission to the binary. -```sh -sudo useradd --no-create-home --shell /bin/false node_exporter -sudo chown -R node_exporter:node_exporter /usr/local/bin/node_exporter -``` -Make a service file: -```sh -sudo nano /etc/systemd/system/node_exporter.service -``` -Start the service -```sh -sudo systemctl daemon-reload -sudo systemctl start node_exporter -sudo systemctl status node_exporter -sudo systemctl enable node_exporter -``` -Node explorer uses port 9100 by default. - -### Install grafana - -Install -```sh -sudo apt-get install -y apt-transport-https software-properties-common wget -sudo wget -q -O /usr/share/keyrings/grafana.key https://apt.grafana.com/gpg.key -echo "deb [signed-by=/usr/share/keyrings/grafana.key] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list -sudo apt update -sudo apt install grafana -``` -Open config -```sh -sudo nano /etc/grafana/grafana.ini -``` -Modify the `http_adr` line to use localhost -```ini -[server] -;http_addr = # Before -http_addr = localhost # After -``` -Start grafana -```sh -sudo systemctl daemon-reload -sudo systemctl start grafana-server -sudo systemctl status grafana-server -sudo systemctl enable grafana-server -``` -This will serve metrics over port 3000. - -Generate a grafana dashboard. From trin root directory: -```sh -cargo run -p trin -- create-dashboard http://localhost:3000 admin admin http://127.0.0.1:9090 -``` -This will create a new monitoring database for trin. This will -be visible in the grafana GUI, or directly at a URL similar to: -http://localhost:3000/d/trin-app-metrics/trin-app-metrics - -If you would like to run the create-dashboard command again, the -data source and the dashboard must be deleted, which can be done in the grafana GUI. - -### Start trin with metrics on - -The metrics port must match the trin job set in: `/etc/prometheus/prometheus.yml`. - -```sh -cargo run -p trin -- \ - --enable-metrics-with-url 127.0.0.1: \ - --web3-http-address http://127.0.0.1: \ - --web3-transport http -``` -For example: - -```sh -cargo run -p trin -- \ - --enable-metrics-with-url 127.0.0.1:9101 \ - --web3-http-address http://127.0.0.1:8545 \ - --web3-transport http -``` - -### Updating metrics dashboard -If there are new changes to the metrics dashboard template that you want to view in -an already-existing dashboard. The simplest way to update your dashboard is to delete -your `prometheus` datasource and `Trin App metrics` dashboard, and re-run the -`create-dashboard` command. - -### View metrics remotely -Trin metrics on a remote machine can be monitored by listening to the grafana -address on a local machine. - -On local run: -```sh -ssh -N -L :127.0.0.1: @ -``` -For example -```sh -ssh -N -L 3000:127.0.0.1:3000 username@mycomputer -``` -Then navigate to [http://127.0.0.1:3000](http://127.0.0.1:3000)` in a browser and login -with username: admin, password: admin. Then navigate to the trin-app-metrics dashboard. - -## Metrics setup with docker -1. Install Docker. -2. Run Prometheus, note that you MUST manually set the absolute path to your copy of Trin's `etc/prometheus/`: -```sh -docker run -p 9090:9090 -v /**absolute/path/to/trin/etc/prometheus**:/etc/prometheus --add-host=host.docker.internal:host-gateway prom/prometheus -``` -3. Run Grafana: -```sh -docker run -p 3000:3000 --add-host=host.docker.internal:host-gateway grafana/grafana:latest -``` -4. Start your Trin process with: +3. Start your Trin process exposing metrics: ```sh cargo run -p trin -- --enable-metrics-with-url 0.0.0.0:9100 --web3-http-address http://0.0.0.0:8545 --web3-transport http ``` @@ -305,12 +62,11 @@ cargo run -p trin -- --enable-metrics-with-url 0.0.0.0:9100 --web3-http-address complete, and requests from docker instances are considered external. - The `--enable-metrics-with-url` parameter is the address that Trin exports metrics to, and should be equal to the port to which your Prometheus server is targeting at the bottom of `prometheus/prometheus.yml` - The `--web-transport http` will allow Grafana to request routing table information from Trin via JSON-RPC over HTTP -5. From the root of the Trin repo, run `cargo run -p trin -- create-dashboard`. If you used different ports than detailed in the above steps, or you are not using docker, then this command's defaults will not work. Run the command with the `-h` flag to see how to provide non-default addresses or credentials. -6. Upon successful dashboard creation, navigate to the dashboard URL that the `create-dashboard` outputs. Use `admin`/`admin` to login. -## Gotchas +4. Navigate to http://localhost:3000/d/trin-metrics/trin-metrics. Use `admin`/`admin` to login. -- If `create-dashboard` fails with an error, the most likely reason is that it has already been run. From within the Grafana UI, delete the "json-rpc" and "prometheus" datasources and the "trin" dashboard and re-run the command. + +## Gotchas - There is a limit on concurrent connections given by the threadpool. At last doc update, that number was 2, but will surely change. If you leave