diff --git a/.gitignore b/.gitignore index fc91e90fd..f241b9a48 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ /kcov-output /results /validator +/logs # desktop app config .DS_Store diff --git a/metrics/README.md b/metrics/README.md index d0cb57fde..cd04b99b1 100644 --- a/metrics/README.md +++ b/metrics/README.md @@ -1,19 +1,19 @@ original src: https://github.com/docker/awesome-compose/tree/master/prometheus-grafana -## Setup +## Setup -requirements: -- `docker compose` +requirements: +- `docker compose` - [https://docs.docker.com/engine/install/ubuntu/](https://docs.docker.com/engine/install/ubuntu/) -- either mac or linux supported +- either mac or linux supported -modify `/etc/hosts` to include the following line: +modify `/etc/hosts` to include the following line: ``` 127.0.0.1 prometheus +127.0.0.1 loki ``` - -## Running +## Running mac: `docker compose -f compose_mac.yaml up -d` linux: `docker compose -f compose_linux.yaml up -d` @@ -21,7 +21,7 @@ linux: `docker compose -f compose_linux.yaml up -d` - grafana will be accessable on `localhost:3000` - note: `username: admin password: grafana` - prometheus will be accessable on `localhost:9090` -- sig metrics will be published to localhost:12345 (if you change this on the sig cli, you will +- sig metrics will be published to localhost:12345 (if you change this on the sig cli, you will need to also modify the prometheus `target` to point to the different port). ## Shutting down @@ -37,31 +37,19 @@ Project structure: . ├── compose_linux.yaml ├── compose_mac.yaml +├── alloy -- this scrapes logs/ and pushes to loki +├── loki -- log database ├── grafana │   └── dashboards/ -- this is where the sig dashboard lives (will need to copy .json export of dashboard from running container and push through git for any dashboard changes) │   └── datasources/ -- this points to prometheus docker ├── prometheus -│   └── prometheus.yml +│   └── prometheus.yml └── README.md ``` -[_compose.yaml_](compose.yaml) -``` -services: - prometheus: - image: prom/prometheus - ... - ports: - - 9090:9090 - grafana: - image: grafana/grafana - ... - ports: - - 3000:3000 -``` -The compose file defines a stack with two services `prometheus` and `grafana`. -When deploying the stack, docker compose maps port the default ports for each service to the equivalent ports on the host in order to inspect easier the web interface of each service. -Make sure the ports 9090 and 3000 on the host are not already in use. +## Run with logs + +`./zig-out/bin/sig gossip -n testnet 2>&1 | tee -a logs/sig.log` ## Deploy with docker compose diff --git a/metrics/alloy/config.alloy b/metrics/alloy/config.alloy new file mode 100644 index 000000000..0480af0d5 --- /dev/null +++ b/metrics/alloy/config.alloy @@ -0,0 +1,16 @@ +local.file_match "local_files" { + path_targets = [{"__path__" = "/var/log/alloy/*.log"}] + sync_period = "1s" +} + +loki.source.file "log_scrape" { + targets = local.file_match.local_files.targets + forward_to = [loki.write.grafana_loki.receiver] + tail_from_end = true +} + +loki.write "grafana_loki" { + endpoint { + url = "http://loki:3100/loki/api/v1/push" + } +} diff --git a/metrics/compose_linux.yaml b/metrics/compose_linux.yaml index 583e698d8..2c8296219 100644 --- a/metrics/compose_linux.yaml +++ b/metrics/compose_linux.yaml @@ -11,6 +11,35 @@ services: volumes: - ./prometheus:/etc/prometheus - prom_data:/prometheus + + loki: + network_mode: "host" # -- only linux + image: grafana/loki:3.0.0 + container_name: loki + ports: + - "3100:3100" + volumes: + - ./loki:/etc/loki + command: + - "--config.file=/etc/loki/loki.yml" + + alloy: + network_mode: "host" # -- only linux + image: grafana/alloy:v1.3.1 + ports: + - "3200:3200" + volumes: + - "./alloy/config.alloy:/etc/alloy/config.alloy" + - "../logs:/var/log/alloy" + command: + [ + "run", + "--server.http.listen-addr=0.0.0.0:3200", + "/etc/alloy/config.alloy", + ] + extra_hosts: + - "host.docker.internal:host-gateway" + grafana: network_mode: "host" # -- only linux image: grafana/grafana @@ -25,6 +54,7 @@ services: - ./grafana/datasources:/etc/grafana/provisioning/datasources - ./grafana/dashboards:/etc/grafana/provisioning/dashboards - ./grafana/dashboards:/var/lib/grafana/dashboards + node-exporter: image: prom/node-exporter container_name: node-exporter diff --git a/metrics/compose_mac.yaml b/metrics/compose_mac.yaml index b7ad2cb46..70dcdd55b 100644 --- a/metrics/compose_mac.yaml +++ b/metrics/compose_mac.yaml @@ -2,14 +2,39 @@ services: prometheus: image: prom/prometheus container_name: prometheus - command: - - "--config.file=/etc/prometheus/prometheus.yml" + restart: unless-stopped ports: - 9090:9090 - restart: unless-stopped volumes: - ./prometheus:/etc/prometheus - prom_data:/prometheus + command: + - "--config.file=/etc/prometheus/prometheus.yml" + + loki: + image: grafana/loki:3.0.0 + container_name: loki + ports: + - "3100:3100" + volumes: + - ./loki:/etc/loki + command: + - "--config.file=/etc/loki/loki.yml" + + alloy: + image: grafana/alloy:v1.3.1 + ports: + - "3200:3200" + volumes: + - "./alloy/config.alloy:/etc/alloy/config.alloy" + - "../logs:/var/log/alloy" + command: + [ + "run", + "--server.http.listen-addr=0.0.0.0:3200", + "/etc/alloy/config.alloy", + ] + grafana: image: grafana/grafana container_name: grafana @@ -23,6 +48,7 @@ services: - ./grafana/datasources:/etc/grafana/provisioning/datasources - ./grafana/dashboards:/etc/grafana/provisioning/dashboards - ./grafana/dashboards:/var/lib/grafana/dashboards + node-exporter: image: prom/node-exporter container_name: node-exporter diff --git a/metrics/grafana/dashboards/gossip_handle_time.json b/metrics/grafana/dashboards/gossip_handle_time.json deleted file mode 100644 index 06c2c6721..000000000 --- a/metrics/grafana/dashboards/gossip_handle_time.json +++ /dev/null @@ -1,555 +0,0 @@ -{ - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": { - "type": "grafana", - "uid": "-- Grafana --" - }, - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "type": "dashboard" - } - ] - }, - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 0, - "id": 2, - "links": [], - "panels": [ - { - "datasource": { - "type": "prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "super-light-blue", - "value": null - }, - { - "color": "semi-dark-yellow", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 6, - "x": 0, - "y": 0 - }, - "id": 7, - "options": { - "displayMode": "gradient", - "maxVizHeight": 300, - "minVizHeight": 16, - "minVizWidth": 8, - "namePlacement": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showUnfilled": true, - "sizing": "auto", - "valueMode": "color" - }, - "pluginVersion": "10.4.1", - "targets": [ - { - "datasource": { - "type": "prometheus" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "handle_batch_prune_time_bucket", - "format": "heatmap", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "{{label_name}}ms", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Prune Messages", - "type": "bargauge" - }, - { - "datasource": { - "type": "prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "super-light-blue", - "value": null - }, - { - "color": "semi-dark-yellow", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 6, - "x": 6, - "y": 0 - }, - "id": 6, - "options": { - "displayMode": "gradient", - "maxVizHeight": 300, - "minVizHeight": 16, - "minVizWidth": 8, - "namePlacement": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showUnfilled": true, - "sizing": "auto", - "valueMode": "color" - }, - "pluginVersion": "10.4.1", - "targets": [ - { - "datasource": { - "type": "prometheus" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "handle_batch_push_time_bucket", - "format": "heatmap", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "{{le}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Push Messages", - "type": "bargauge" - }, - { - "datasource": { - "type": "prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "super-light-blue", - "value": null - }, - { - "color": "semi-dark-yellow", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 6, - "x": 12, - "y": 0 - }, - "id": 5, - "options": { - "displayMode": "gradient", - "maxVizHeight": 300, - "minVizHeight": 16, - "minVizWidth": 8, - "namePlacement": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showUnfilled": true, - "sizing": "auto", - "valueMode": "color" - }, - "pluginVersion": "10.4.1", - "targets": [ - { - "datasource": { - "type": "prometheus" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "handle_batch_pull_resp_time_bucket", - "format": "heatmap", - "fullMetaSearch": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Pull Response", - "type": "bargauge" - }, - { - "datasource": { - "type": "prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "super-light-blue", - "value": null - }, - { - "color": "semi-dark-yellow", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 6, - "x": 18, - "y": 0 - }, - "id": 4, - "options": { - "displayMode": "gradient", - "maxVizHeight": 300, - "minVizHeight": 16, - "minVizWidth": 8, - "namePlacement": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showUnfilled": true, - "sizing": "auto", - "valueMode": "color" - }, - "pluginVersion": "10.4.1", - "targets": [ - { - "datasource": { - "type": "prometheus" - }, - "disableTextWrap": false, - "editorMode": "builder", - "exemplar": false, - "expr": "handle_batch_pull_req_time_bucket", - "format": "heatmap", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": false, - "instant": false, - "interval": "", - "legendFormat": "{{le}}ms", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Pull Request", - "type": "bargauge" - }, - { - "datasource": { - "type": "prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "super-light-blue", - "value": null - }, - { - "color": "semi-dark-yellow", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 6, - "x": 0, - "y": 8 - }, - "id": 1, - "options": { - "displayMode": "gradient", - "maxVizHeight": 300, - "minVizHeight": 16, - "minVizWidth": 8, - "namePlacement": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showUnfilled": true, - "sizing": "auto", - "valueMode": "color" - }, - "pluginVersion": "10.4.1", - "targets": [ - { - "datasource": { - "type": "prometheus" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "handle_batch_ping_time_bucket", - "format": "heatmap", - "fullMetaSearch": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Ping Message Handle Time", - "type": "bargauge" - }, - { - "datasource": { - "type": "prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "super-light-blue", - "value": null - }, - { - "color": "semi-dark-yellow", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 6, - "x": 6, - "y": 8 - }, - "id": 2, - "options": { - "displayMode": "gradient", - "maxVizHeight": 300, - "minVizHeight": 16, - "minVizWidth": 8, - "namePlacement": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showUnfilled": true, - "sizing": "auto", - "valueMode": "color" - }, - "pluginVersion": "10.4.1", - "targets": [ - { - "datasource": { - "type": "prometheus" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "handle_batch_pong_time_bucket", - "format": "heatmap", - "fullMetaSearch": false, - "includeNullMetadata": false, - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Pong Handle", - "type": "bargauge" - }, - { - "datasource": { - "type": "prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 8 - }, - "id": 8, - "options": { - "displayMode": "gradient", - "maxVizHeight": 300, - "minVizHeight": 16, - "minVizWidth": 8, - "namePlacement": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showUnfilled": true, - "sizing": "auto", - "valueMode": "color" - }, - "pluginVersion": "10.4.1", - "targets": [ - { - "datasource": { - "type": "prometheus" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "handle_trim_table_time_bucket", - "format": "heatmap", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Trim Gossip Table", - "type": "bargauge" - } - ], - "refresh": "5s", - "schemaVersion": 39, - "tags": [], - "templating": { - "list": [] - }, - "time": { - "from": "now-5m", - "to": "now" - }, - "timepicker": {}, - "timezone": "browser", - "title": "Message Handle Times", - "uid": "edsmxaysv0sn4b", - "version": 13, - "weekStart": "" - } \ No newline at end of file diff --git a/metrics/grafana/dashboards/gossip_metrics.json b/metrics/grafana/dashboards/gossip_metrics.json index 394de648d..340c1d6b5 100644 --- a/metrics/grafana/dashboards/gossip_metrics.json +++ b/metrics/grafana/dashboards/gossip_metrics.json @@ -24,7 +24,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 3, + "id": 2, "links": [], "liveNow": false, "panels": [ @@ -770,10 +770,7 @@ "id": "byNames", "options": { "mode": "exclude", - "names": [ - "table_pubkeys_dropped", - "table_old_values_removed" - ], + "names": ["table_pubkeys_dropped", "table_old_values_removed"], "prefix": "All except:", "readOnly": true } @@ -1035,8 +1032,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1215,8 +1211,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1378,57 +1373,22 @@ }, { "datasource": { - "default": true, "type": "prometheus" }, "fieldConfig": { "defaults": { "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } + "mode": "thresholds" }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "super-light-blue" }, { - "color": "red", + "color": "semi-dark-yellow", "value": 80 } ] @@ -1438,23 +1398,98 @@ }, "gridPos": { "h": 8, - "w": 12, + "w": 6, "x": 0, "y": 32 }, - "id": 14, + "id": 20, "options": { - "legend": { - "calcs": [], - "displayMode": "table", - "placement": "bottom", - "showLegend": true + "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false }, - "tooltip": { - "mode": "single", - "sort": "none" + "showUnfilled": true, + "sizing": "auto", + "valueMode": "color" + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "datasource": { + "type": "prometheus" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "handle_batch_pull_resp_time_bucket", + "format": "heatmap", + "fullMetaSearch": false, + "includeNullMetadata": false, + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false } + ], + "title": "Pull Response : Handle Time", + "type": "bargauge" + }, + { + "datasource": { + "type": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "super-light-blue" + }, + { + "color": "semi-dark-yellow", + "value": 80 + } + ] + } + }, + "overrides": [] }, + "gridPos": { + "h": 8, + "w": 6, + "x": 6, + "y": 32 + }, + "id": 19, + "options": { + "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showUnfilled": true, + "sizing": "auto", + "valueMode": "color" + }, + "pluginVersion": "11.2.0", "targets": [ { "datasource": { @@ -1462,35 +1497,372 @@ }, "disableTextWrap": false, "editorMode": "builder", - "expr": "delta(push_messages_time_to_insert[$__interval])", + "expr": "handle_batch_push_time_bucket", + "format": "heatmap", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "interval": "", - "legendFormat": "time_to_insert", + "legendFormat": "{{le}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Push : Handle Time", + "type": "bargauge" + }, + { + "datasource": { + "type": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "super-light-blue" + }, + { + "color": "semi-dark-yellow", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 6, + "x": 12, + "y": 32 + }, + "id": 23, + "options": { + "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showUnfilled": true, + "sizing": "auto", + "valueMode": "color" + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "datasource": { + "type": "prometheus" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "handle_batch_pong_time_bucket", + "format": "heatmap", + "fullMetaSearch": false, + "includeNullMetadata": false, + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Pong : Handle Time", + "type": "bargauge" + }, + { + "datasource": { + "type": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "super-light-blue" + }, + { + "color": "semi-dark-yellow", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 6, + "x": 18, + "y": 32 + }, + "id": 22, + "options": { + "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showUnfilled": true, + "sizing": "auto", + "valueMode": "color" + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "datasource": { + "type": "prometheus" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "handle_batch_ping_time_bucket", + "format": "heatmap", + "fullMetaSearch": false, + "includeNullMetadata": false, + "instant": false, + "legendFormat": "__auto", "range": true, "refId": "A", "useBackend": false + } + ], + "title": "Ping : Handle Time", + "type": "bargauge" + }, + { + "datasource": { + "type": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "super-light-blue" + }, + { + "color": "semi-dark-yellow", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 6, + "x": 0, + "y": 40 + }, + "id": 21, + "options": { + "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false }, + "showUnfilled": true, + "sizing": "auto", + "valueMode": "color" + }, + "pluginVersion": "11.2.0", + "targets": [ { "datasource": { "type": "prometheus" }, "disableTextWrap": false, "editorMode": "builder", - "expr": "delta(push_messages_time_build_prune[$__interval])", + "exemplar": false, + "expr": "handle_batch_pull_req_time_bucket", + "format": "heatmap", "fullMetaSearch": false, "hide": false, + "includeNullMetadata": false, + "instant": false, + "interval": "", + "legendFormat": "{{le}}ms", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Pull Request : Handle Time", + "type": "bargauge" + }, + { + "datasource": { + "type": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "super-light-blue" + }, + { + "color": "semi-dark-yellow", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 6, + "x": 6, + "y": 40 + }, + "id": 18, + "options": { + "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showUnfilled": true, + "sizing": "auto", + "valueMode": "color" + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "datasource": { + "type": "prometheus" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "handle_batch_prune_time_bucket", + "format": "heatmap", + "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "legendFormat": "time_build_prune", + "legendFormat": "{{label_name}}ms", "range": true, - "refId": "B", + "refId": "A", "useBackend": false } ], - "title": "Push Message Processing Times", - "type": "timeseries" + "title": "Prune : Handle Time", + "type": "bargauge" + }, + { + "datasource": { + "type": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 40 + }, + "id": 24, + "options": { + "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": ["lastNotNull"], + "fields": "", + "values": false + }, + "showUnfilled": true, + "sizing": "auto", + "valueMode": "color" + }, + "pluginVersion": "11.2.0", + "targets": [ + { + "datasource": { + "type": "prometheus" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "handle_trim_table_time_bucket", + "format": "heatmap", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Trim Table : Handle Time", + "type": "bargauge" } ], "refresh": "", @@ -1508,6 +1880,6 @@ "timezone": "", "title": "Gossip Metrics", "uid": "jBuN47BVz", - "version": 5, + "version": 3, "weekStart": "" -} \ No newline at end of file +} diff --git a/metrics/grafana/datasources/datasource.yml b/metrics/grafana/datasources/datasource.yml index 44999d469..b7135f221 100644 --- a/metrics/grafana/datasources/datasource.yml +++ b/metrics/grafana/datasources/datasource.yml @@ -7,3 +7,12 @@ datasources: isDefault: true access: proxy editable: true + - name: Loki + type: loki + access: proxy + orgId: 1 + url: http://loki:3100 + basicAuth: false + isDefault: false + version: 1 + editable: false diff --git a/metrics/loki/loki.yml b/metrics/loki/loki.yml new file mode 100644 index 000000000..cac8586c2 --- /dev/null +++ b/metrics/loki/loki.yml @@ -0,0 +1,29 @@ +# This is a complete configuration to deploy Loki backed by the filesystem. +# The index will be shipped to the storage via tsdb-shipper. + +auth_enabled: false + +server: + http_listen_port: 3100 + +common: + ring: + instance_addr: 127.0.0.1 + kvstore: + store: inmemory + replication_factor: 1 + path_prefix: /tmp/loki + +schema_config: + configs: + - from: 2020-05-15 + store: tsdb + object_store: filesystem + schema: v13 + index: + prefix: index_ + period: 24h + +storage_config: + filesystem: + directory: /tmp/loki/chunks