Добавлен балансировщик Traefik

This commit is contained in:
2026-04-24 23:05:29 +03:00
parent 6bb29174a5
commit b15786b26d
5 changed files with 1110 additions and 18 deletions

View File

@@ -170,17 +170,22 @@ tsung-test: ## Запустить нагрузочный тест Tsung
@echo "Отчёт: logs/tsung/*/report.html" @echo "Отчёт: logs/tsung/*/report.html"
wrk-register: ## Нагрузочный тест регистрации (wrk2) 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) wrk-search: ## Нагрузочный тест поиска (wrk2)
@TOKEN=$$(curl -s -X POST http://localhost:8080/v1/register \ @TOKEN=$$(curl -s -X POST http://localhost:8080/v1/register \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{"email":"wrktest@test.com","password":"pass"}' | \ -d '{"email":"wrktest@test.com","password":"pass"}' | \
grep -o '"token":"[^"]*"' | cut -d'"' -f4); \ grep -o '"token":"[^"]*"' | cut -d'"' -f4); \
wrk -t4 -c100 -d30s -R200 \ wrk -t4 -c100 -d30s -t200 \
-H "Authorization: Bearer $$TOKEN" \ -H "Authorization: Bearer $$TOKEN" \
http://localhost:8080/v1/search?type=event\&q=test 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 # CODE QUALITY
# ============================================================================ # ============================================================================
@@ -258,6 +263,10 @@ docker-compose-up: ## Запустить кластер (3 ноды)
@echo "Node 1: http://localhost:8080" @echo "Node 1: http://localhost:8080"
@echo "Node 2: http://localhost:8082" @echo "Node 2: http://localhost:8082"
@echo "Node 3: http://localhost:8084" @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: ## Остановить кластер docker-compose-down: ## Остановить кластер
@echo "Остановка кластера..." @echo "Остановка кластера..."

View File

@@ -1,5 +1,34 @@
# docker/docker-compose.yml # docker/docker-compose.yml
services: 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 ==================
eventhub-node1: eventhub-node1:
build: build:
@@ -15,11 +44,28 @@ services:
- eventhub-net - eventhub-net
volumes: volumes:
- eventhub-node1-data:/app/data - eventhub-node1-data:/app/data
ports: labels:
- "8080:8080" # REST API - "traefik.enable=true"
- "8081:8081" # WebSocket # REST API пользователей
- "8445:8445" # Admin REST - "traefik.http.routers.api.rule=Host(`api.eventhub.local`)"
- "8446:8446" # Admin WebSocket - "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 restart: unless-stopped
eventhub-node2: eventhub-node2:
@@ -36,11 +82,24 @@ services:
- eventhub-net - eventhub-net
volumes: volumes:
- eventhub-node2-data:/app/data - eventhub-node2-data:/app/data
ports: labels:
- "8082:8080" - "traefik.enable=true"
- "8083:8081" - "traefik.http.routers.api.rule=Host(`api.eventhub.local`)"
- "9445:8445" - "traefik.http.routers.api.entrypoints=web"
- "9446:8446" - "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 restart: unless-stopped
eventhub-node3: eventhub-node3:
@@ -57,16 +116,37 @@ services:
- eventhub-net - eventhub-net
volumes: volumes:
- eventhub-node3-data:/app/data - eventhub-node3-data:/app/data
ports: labels:
- "8084:8080" - "traefik.enable=true"
- "8085:8081" - "traefik.http.routers.api.rule=Host(`api.eventhub.local`)"
- "11445:8445" - "traefik.http.routers.api.entrypoints=web"
- "11446:8446" - "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 restart: unless-stopped
# ================== Мониторинг ================== # ================== Мониторинг ==================
prometheus: prometheus:
image: prom/prometheus:latest 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: volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus-data:/prometheus - prometheus-data:/prometheus
@@ -80,8 +160,12 @@ services:
image: grafana/grafana:latest image: grafana/grafana:latest
environment: environment:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD} - 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: volumes:
- ./grafana/provisioning:/etc/grafana/provisioning - ./grafana/provisioning:/etc/grafana/provisioning
- ./grafana/dashboards:/etc/grafana/dashboards
- grafana-data:/var/lib/grafana - grafana-data:/var/lib/grafana
networks: networks:
- eventhub-net - eventhub-net

View File

@@ -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
}

View File

@@ -20,3 +20,8 @@ scrape_configs:
labels: labels:
node: 'node3' node: 'node3'
metrics_path: '/metrics/default' metrics_path: '/metrics/default'
- job_name: 'traefik'
scrape_interval: 15s
static_configs:
- targets: [ 'traefik:8080' ]
metrics_path: '/metrics'