From b15786b26ddc6b264bfe85440bbd857e02ecae4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9=20=D0=A1=D0=B0?= =?UTF-8?q?=D0=B1=D0=B8=D0=BB=D0=B8=D0=BD?= Date: Fri, 24 Apr 2026 23:05:29 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=B1=D0=B0=D0=BB=D0=B0=D0=BD=D1=81=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D1=89=D0=B8=D0=BA=20Traefik?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 13 +- docker/docker-compose.yml | 114 +- .../{ => dashboards}/eventhub-erlang.json | 0 docker/grafana/dashboards/traefik.json | 994 ++++++++++++++++++ docker/prometheus/prometheus.yml | 7 +- 5 files changed, 1110 insertions(+), 18 deletions(-) rename docker/grafana/{ => dashboards}/eventhub-erlang.json (100%) create mode 100644 docker/grafana/dashboards/traefik.json diff --git a/Makefile b/Makefile index e6013b1..c37aaa2 100644 --- a/Makefile +++ b/Makefile @@ -170,17 +170,22 @@ tsung-test: ## Запустить нагрузочный тест Tsung @echo "Отчёт: logs/tsung/*/report.html" wrk-register: ## Нагрузочный тест регистрации (wrk2) - @wrk -t4 -c100 -d30s -t100 -s test/wrk/scripts/wrk_register.lua http://localhost:8080/v1/register + @wrk -t4 -c100 -d30s -t100 -s test/wrk/scripts/wrk_register.lua http://localhost/v1/register wrk-search: ## Нагрузочный тест поиска (wrk2) @TOKEN=$$(curl -s -X POST http://localhost:8080/v1/register \ -H "Content-Type: application/json" \ -d '{"email":"wrktest@test.com","password":"pass"}' | \ grep -o '"token":"[^"]*"' | cut -d'"' -f4); \ - wrk -t4 -c100 -d30s -R200 \ + wrk -t4 -c100 -d30s -t200 \ -H "Authorization: Bearer $$TOKEN" \ http://localhost:8080/v1/search?type=event\&q=test +wrk-health: ## Нагрузочный тест health (wrk2) + wrk -t4 -c10000 -d30s -t200 \ + -H "Host: api.eventhub.local" \ + http://localhost/health + # ============================================================================ # CODE QUALITY # ============================================================================ @@ -258,6 +263,10 @@ docker-compose-up: ## Запустить кластер (3 ноды) @echo "Node 1: http://localhost:8080" @echo "Node 2: http://localhost:8082" @echo "Node 3: http://localhost:8084" + @echo "Prometheus: http://localhost:9090" + @echo "Grafana: http://localhost:3000" + @echo "ObserverWeb: http://localhost:4000/observer/" + @echo "Traefik: http://localhost:8080" docker-compose-down: ## Остановить кластер @echo "Остановка кластера..." diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 1cb1144..33d048f 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,5 +1,34 @@ # docker/docker-compose.yml services: + # ================== Балансировщик нагрузки ================== + traefik: + image: traefik:latest + user: "0:1001" # группа docker на хосте (подберите при необходимости, см. ls -la /var/run/docker.sock) + command: + - "--api.insecure=true" # дашборд (можно отключить в production) + - "--providers.docker=true" + - "--providers.docker.exposedbydefault=false" + - "--entrypoints.web.address=:80" # пользовательский REST + - "--entrypoints.ws.address=:8081" # пользовательский WebSocket + - "--entrypoints.admin-web.address=:8445" # админский REST + - "--entrypoints.admin-ws.address=:8446" # админский WebSocket + # === Включаем метрики Prometheus === + - "--metrics.prometheus=true" + - "--metrics.prometheus.buckets=0.1,0.3,1.2,5.0" + - "--metrics.prometheus.addEntryPointsLabels=true" + - "--metrics.prometheus.addServicesLabels=true" + ports: + - "80:80" + - "8080:8080" + - "8081:8081" + - "8445:8445" + - "8446:8446" + volumes: + - "/var/run/docker.sock:/var/run/docker.sock:ro" + networks: + - eventhub-net + restart: unless-stopped + # ================== Кластер EventHub ================== eventhub-node1: build: @@ -15,11 +44,28 @@ services: - eventhub-net volumes: - eventhub-node1-data:/app/data - ports: - - "8080:8080" # REST API - - "8081:8081" # WebSocket - - "8445:8445" # Admin REST - - "8446:8446" # Admin WebSocket + labels: + - "traefik.enable=true" + # REST API пользователей + - "traefik.http.routers.api.rule=Host(`api.eventhub.local`)" + - "traefik.http.routers.api.entrypoints=web" + - "traefik.http.routers.api.service=api" + - "traefik.http.services.api.loadbalancer.server.port=8080" + # WebSocket пользователей + - "traefik.http.routers.ws.rule=Host(`ws.eventhub.local`)" + - "traefik.http.routers.ws.entrypoints=ws" + - "traefik.http.routers.ws.service=ws" + - "traefik.http.services.ws.loadbalancer.server.port=8081" + # Админский REST + - "traefik.http.routers.admin-api.rule=Host(`admin.eventhub.local`)" + - "traefik.http.routers.admin-api.entrypoints=admin-web" + - "traefik.http.routers.admin-api.service=admin-api" + - "traefik.http.services.admin-api.loadbalancer.server.port=8445" + # Админский WebSocket + - "traefik.http.routers.admin-ws.rule=Host(`admin-ws.eventhub.local`)" + - "traefik.http.routers.admin-ws.entrypoints=admin-ws" + - "traefik.http.routers.admin-ws.service=admin-ws" + - "traefik.http.services.admin-ws.loadbalancer.server.port=8446" restart: unless-stopped eventhub-node2: @@ -36,11 +82,24 @@ services: - eventhub-net volumes: - eventhub-node2-data:/app/data - ports: - - "8082:8080" - - "8083:8081" - - "9445:8445" - - "9446:8446" + labels: + - "traefik.enable=true" + - "traefik.http.routers.api.rule=Host(`api.eventhub.local`)" + - "traefik.http.routers.api.entrypoints=web" + - "traefik.http.routers.api.service=api" + - "traefik.http.services.api.loadbalancer.server.port=8080" + - "traefik.http.routers.ws.rule=Host(`ws.eventhub.local`)" + - "traefik.http.routers.ws.entrypoints=ws" + - "traefik.http.routers.ws.service=ws" + - "traefik.http.services.ws.loadbalancer.server.port=8081" + - "traefik.http.routers.admin-api.rule=Host(`admin.eventhub.local`)" + - "traefik.http.routers.admin-api.entrypoints=admin-web" + - "traefik.http.routers.admin-api.service=admin-api" + - "traefik.http.services.admin-api.loadbalancer.server.port=8445" + - "traefik.http.routers.admin-ws.rule=Host(`admin-ws.eventhub.local`)" + - "traefik.http.routers.admin-ws.entrypoints=admin-ws" + - "traefik.http.routers.admin-ws.service=admin-ws" + - "traefik.http.services.admin-ws.loadbalancer.server.port=8446" restart: unless-stopped eventhub-node3: @@ -57,16 +116,37 @@ services: - eventhub-net volumes: - eventhub-node3-data:/app/data - ports: - - "8084:8080" - - "8085:8081" - - "11445:8445" - - "11446:8446" + labels: + - "traefik.enable=true" + - "traefik.http.routers.api.rule=Host(`api.eventhub.local`)" + - "traefik.http.routers.api.entrypoints=web" + - "traefik.http.routers.api.service=api" + - "traefik.http.services.api.loadbalancer.server.port=8080" + - "traefik.http.routers.ws.rule=Host(`ws.eventhub.local`)" + - "traefik.http.routers.ws.entrypoints=ws" + - "traefik.http.routers.ws.service=ws" + - "traefik.http.services.ws.loadbalancer.server.port=8081" + - "traefik.http.routers.admin-api.rule=Host(`admin.eventhub.local`)" + - "traefik.http.routers.admin-api.entrypoints=admin-web" + - "traefik.http.routers.admin-api.service=admin-api" + - "traefik.http.services.admin-api.loadbalancer.server.port=8445" + - "traefik.http.routers.admin-ws.rule=Host(`admin-ws.eventhub.local`)" + - "traefik.http.routers.admin-ws.entrypoints=admin-ws" + - "traefik.http.routers.admin-ws.service=admin-ws" + - "traefik.http.services.admin-ws.loadbalancer.server.port=8446" restart: unless-stopped # ================== Мониторинг ================== prometheus: image: prom/prometheus:latest + command: + - '--config.file=/etc/prometheus/prometheus.yml' + - '--storage.tsdb.path=/prometheus' + - '--web.console.libraries=/usr/share/prometheus/console_libraries' + - '--web.console.templates=/usr/share/prometheus/consoles' + # === Ограничение retention === + - '--storage.tsdb.retention.time=30d' # хранить данные 30 дней + - '--storage.tsdb.retention.size=15GB' # максимальный размер 15 ГБ volumes: - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml - prometheus-data:/prometheus @@ -80,8 +160,12 @@ services: image: grafana/grafana:latest environment: - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD} + - GF_SECURITY_DISABLE_INITIAL_ADMIN_PASSWORD_CHANGE=false # обязательно сменить пароль после первого входа + - GF_USERS_ALLOW_SIGN_UP=false # запретить самостоятельную регистрацию + - GF_AUTH_ANONYMOUS_ENABLED=false # запретить анонимный доступ volumes: - ./grafana/provisioning:/etc/grafana/provisioning + - ./grafana/dashboards:/etc/grafana/dashboards - grafana-data:/var/lib/grafana networks: - eventhub-net diff --git a/docker/grafana/eventhub-erlang.json b/docker/grafana/dashboards/eventhub-erlang.json similarity index 100% rename from docker/grafana/eventhub-erlang.json rename to docker/grafana/dashboards/eventhub-erlang.json diff --git a/docker/grafana/dashboards/traefik.json b/docker/grafana/dashboards/traefik.json new file mode 100644 index 0000000..4eabf1f --- /dev/null +++ b/docker/grafana/dashboards/traefik.json @@ -0,0 +1,994 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "gnetId": null, + "graphTooltip": 0, + "id": null, + "links": [], + "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 10, + "panels": [], + "title": "Overview", + "type": "row" + }, + { + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 12, + "x": 0, + "y": 1 + }, + "id": 2, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "8.0.0", + "targets": [ + { + "expr": "traefik_config_last_reload_success", + "legendFormat": "Last reload success", + "refId": "A" + } + ], + "title": "Last Config Reload Success", + "type": "stat" + }, + { + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 12, + "x": 12, + "y": 1 + }, + "id": 3, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "8.0.0", + "targets": [ + { + "expr": "traefik_config_reloads_total", + "legendFormat": "Total reloads", + "refId": "A" + } + ], + "title": "Total Config Reloads", + "type": "stat" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 4 + }, + "id": 11, + "panels": [], + "title": "Traffic", + "type": "row" + }, + { + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 5 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi" + } + }, + "targets": [ + { + "expr": "sum(rate(traefik_entrypoint_requests_total{entrypoint=~\"$entrypoint\"}[$__rate_interval])) by (entrypoint, code)", + "legendFormat": "{{entrypoint}} - {{code}}", + "refId": "A" + } + ], + "title": "Request Rate (by entrypoint and status code)", + "type": "timeseries" + }, + { + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 5 + }, + "id": 5, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi" + } + }, + "targets": [ + { + "expr": "sum(rate(traefik_entrypoint_requests_total{entrypoint=~\"$entrypoint\"}[$__rate_interval])) by (entrypoint)", + "legendFormat": "{{entrypoint}}", + "refId": "A" + } + ], + "title": "Total Request Rate (by entrypoint)", + "type": "timeseries" + }, + { + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 13 + }, + "id": 6, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi" + } + }, + "targets": [ + { + "expr": "sum(rate(traefik_entrypoint_requests_bytes_total{entrypoint=~\"$entrypoint\"}[$__rate_interval])) by (entrypoint) / 1024", + "legendFormat": "{{entrypoint}}", + "refId": "A" + } + ], + "title": "Request Throughput (KB/s)", + "type": "timeseries" + }, + { + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 13 + }, + "id": 7, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi" + } + }, + "targets": [ + { + "expr": "sum(rate(traefik_entrypoint_responses_bytes_total{entrypoint=~\"$entrypoint\"}[$__rate_interval])) by (entrypoint) / 1024", + "legendFormat": "{{entrypoint}}", + "refId": "A" + } + ], + "title": "Response Throughput (KB/s)", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 21 + }, + "id": 12, + "panels": [], + "title": "Latency", + "type": "row" + }, + { + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 22 + }, + "id": 8, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi" + } + }, + "targets": [ + { + "expr": "histogram_quantile(0.99, sum(rate(traefik_entrypoint_request_duration_seconds_bucket{entrypoint=~\"$entrypoint\"}[$__rate_interval])) by (le, entrypoint))", + "legendFormat": "p99 {{entrypoint}}", + "refId": "A" + }, + { + "expr": "histogram_quantile(0.95, sum(rate(traefik_entrypoint_request_duration_seconds_bucket{entrypoint=~\"$entrypoint\"}[$__rate_interval])) by (le, entrypoint))", + "legendFormat": "p95 {{entrypoint}}", + "refId": "B" + }, + { + "expr": "histogram_quantile(0.50, sum(rate(traefik_entrypoint_request_duration_seconds_bucket{entrypoint=~\"$entrypoint\"}[$__rate_interval])) by (le, entrypoint))", + "legendFormat": "p50 {{entrypoint}}", + "refId": "C" + } + ], + "title": "Request Duration Quantiles (by entrypoint)", + "type": "timeseries" + }, + { + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 22 + }, + "id": 9, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi" + } + }, + "targets": [ + { + "expr": "sum(rate(traefik_entrypoint_request_duration_seconds_sum{entrypoint=~\"$entrypoint\"}[$__rate_interval])) by (entrypoint) / sum(rate(traefik_entrypoint_request_duration_seconds_count{entrypoint=~\"$entrypoint\"}[$__rate_interval])) by (entrypoint)", + "legendFormat": "avg {{entrypoint}}", + "refId": "A" + } + ], + "title": "Average Request Duration (by entrypoint)", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 30 + }, + "id": 13, + "panels": [], + "title": "Connections", + "type": "row" + }, + { + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 31 + }, + "id": 14, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi" + } + }, + "targets": [ + { + "expr": "traefik_open_connections{entrypoint=~\"$entrypoint\"}", + "legendFormat": "{{entrypoint}} - {{protocol}}", + "refId": "A" + } + ], + "title": "Open Connections", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 39 + }, + "id": 15, + "panels": [], + "title": "Go Runtime", + "type": "row" + }, + { + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 40 + }, + "id": 16, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi" + } + }, + "targets": [ + { + "expr": "go_goroutines", + "legendFormat": "goroutines", + "refId": "A" + } + ], + "title": "Goroutines", + "type": "timeseries" + }, + { + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 40 + }, + "id": 17, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi" + } + }, + "targets": [ + { + "expr": "go_memstats_alloc_bytes", + "legendFormat": "alloc_bytes", + "refId": "A" + }, + { + "expr": "go_memstats_sys_bytes", + "legendFormat": "sys_bytes", + "refId": "B" + } + ], + "title": "Memory (alloc / sys)", + "type": "timeseries" + }, + { + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "tooltip": false, + "viz": false, + "legend": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 48 + }, + "id": 18, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi" + } + }, + "targets": [ + { + "expr": "rate(go_memstats_gc_sys_bytes[$__rate_interval])", + "legendFormat": "GC sys bytes rate", + "refId": "A" + } + ], + "title": "GC Sys Bytes Rate", + "type": "timeseries" + } + ], + "refresh": "30s", + "schemaVersion": 27, + "style": "dark", + "tags": ["traefik", "loadbalancer"], + "templating": { + "list": [ + { + "current": { + "selected": true, + "text": ["All"], + "value": ["$__all"] + }, + "hide": 0, + "includeAll": true, + "label": "Entrypoint", + "multi": true, + "name": "entrypoint", + "options": [ + { "selected": true, "text": "All", "value": "$__all" }, + { "selected": false, "text": "web", "value": "web" }, + { "selected": false, "text": "ws", "value": "ws" }, + { "selected": false, "text": "admin-web", "value": "admin-web" }, + { "selected": false, "text": "admin-ws", "value": "admin-ws" } + ], + "query": "web,ws,admin-web,admin-ws", + "type": "custom" + } + ] + }, + "time": { + "from": "now-15m", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Traefik Balancer", + "uid": "traefik-balancer", + "version": 1 +} \ No newline at end of file diff --git a/docker/prometheus/prometheus.yml b/docker/prometheus/prometheus.yml index 2db29e1..a8cf810 100644 --- a/docker/prometheus/prometheus.yml +++ b/docker/prometheus/prometheus.yml @@ -19,4 +19,9 @@ scrape_configs: - targets: ['eventhub-node3:8080'] labels: node: 'node3' - metrics_path: '/metrics/default' \ No newline at end of file + metrics_path: '/metrics/default' + - job_name: 'traefik' + scrape_interval: 15s + static_configs: + - targets: [ 'traefik:8080' ] + metrics_path: '/metrics' \ No newline at end of file