forked from mtusi2026/mtusi2026lab7
Implement lab 7 transport security and worker containment
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
services:
|
||||
relay:
|
||||
restart: "no"
|
||||
environment:
|
||||
FAULT_POINT: ${RELAY_FAULT_POINT:-}
|
||||
OUTBOX_POLL_SECONDS: "0.5"
|
||||
SWEEP_INTERVAL_SECONDS: "1"
|
||||
STAGING_RETENTION_SECONDS: ${FAULT_STAGING_RETENTION_SECONDS:-${STAGING_RETENTION_SECONDS:-86400}}
|
||||
|
||||
worker:
|
||||
restart: "no"
|
||||
environment:
|
||||
FAULT_POINT: ${WORKER_FAULT_POINT:-}
|
||||
FAULT_STALL_SECONDS: ${FAULT_STALL_SECONDS:-15}
|
||||
JOB_TIMEOUT_SECONDS: ${FAULT_JOB_TIMEOUT_SECONDS:-5}
|
||||
JOB_BACKOFF_BASE_SECONDS: ${FAULT_BACKOFF_BASE_SECONDS:-1}
|
||||
RENDER_TIMEOUT_SECONDS: ${FAULT_RENDER_TIMEOUT_SECONDS:-${RENDER_TIMEOUT_SECONDS:-30}}
|
||||
RENDER_MEMORY_MB: ${FAULT_RENDER_MEMORY_MB:-${RENDER_MEMORY_MB:-448}}
|
||||
@@ -0,0 +1,863 @@
|
||||
{
|
||||
"uid": "messenger-api",
|
||||
"title": "Messenger · API RED",
|
||||
"description": "RED по endpoint, SLI/SLO, логи и трассы API.",
|
||||
"tags": [
|
||||
"messenger",
|
||||
"lab6",
|
||||
"red"
|
||||
],
|
||||
"timezone": "browser",
|
||||
"editable": false,
|
||||
"graphTooltip": 1,
|
||||
"refresh": "10s",
|
||||
"schemaVersion": 41,
|
||||
"version": 1,
|
||||
"time": {
|
||||
"from": "now-30m",
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {},
|
||||
"fiscalYearStartMonth": 0,
|
||||
"liveNow": false,
|
||||
"links": [
|
||||
{
|
||||
"title": "Messenger",
|
||||
"type": "dashboards",
|
||||
"tags": [
|
||||
"messenger"
|
||||
],
|
||||
"asDropdown": true,
|
||||
"includeVars": false,
|
||||
"keepTime": true
|
||||
}
|
||||
],
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"builtIn": 1,
|
||||
"datasource": {
|
||||
"type": "grafana",
|
||||
"uid": "-- Grafana --"
|
||||
},
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"type": "dashboard"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"enable": true,
|
||||
"iconColor": "red",
|
||||
"name": "Firing alerts",
|
||||
"expr": "ALERTS{alertstate=\"firing\"}",
|
||||
"step": "15s",
|
||||
"titleFormat": "{{alertname}}",
|
||||
"textFormat": "{{alertname}} firing",
|
||||
"useValueForTime": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"templating": {
|
||||
"list": [
|
||||
{
|
||||
"name": "route",
|
||||
"label": "Маршрут",
|
||||
"type": "query",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"query": {
|
||||
"query": "label_values(http_server_request_duration_seconds_count{job=\"messenger-api\"}, http_route)",
|
||||
"refId": "PrometheusVariableQueryEditor-VariableQuery",
|
||||
"qryType": 1
|
||||
},
|
||||
"definition": "label_values(http_server_request_duration_seconds_count{job=\"messenger-api\"}, http_route)",
|
||||
"refresh": 2,
|
||||
"includeAll": true,
|
||||
"multi": true,
|
||||
"allValue": ".*",
|
||||
"current": {
|
||||
"selected": true,
|
||||
"text": [
|
||||
"All"
|
||||
],
|
||||
"value": [
|
||||
"$__all"
|
||||
]
|
||||
},
|
||||
"sort": 1
|
||||
},
|
||||
{
|
||||
"name": "instance",
|
||||
"label": "Реплика",
|
||||
"type": "query",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"query": {
|
||||
"query": "label_values(http_server_request_duration_seconds_count{job=\"messenger-api\"}, instance)",
|
||||
"refId": "PrometheusVariableQueryEditor-VariableQuery",
|
||||
"qryType": 1
|
||||
},
|
||||
"definition": "label_values(http_server_request_duration_seconds_count{job=\"messenger-api\"}, instance)",
|
||||
"refresh": 2,
|
||||
"includeAll": true,
|
||||
"multi": true,
|
||||
"allValue": ".*",
|
||||
"current": {
|
||||
"selected": true,
|
||||
"text": [
|
||||
"All"
|
||||
],
|
||||
"value": [
|
||||
"$__all"
|
||||
]
|
||||
},
|
||||
"sort": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"panels": [
|
||||
{
|
||||
"type": "stat",
|
||||
"title": "RPS бизнес-запросов",
|
||||
"description": "Все маршруты, кроме /health/*; сумма по репликам.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\"}[$__rate_interval]))",
|
||||
"legendFormat": "__auto",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "reqps",
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"colorMode": "value",
|
||||
"graphMode": "area",
|
||||
"textMode": "auto"
|
||||
},
|
||||
"id": 1,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 6,
|
||||
"h": 4
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "stat",
|
||||
"title": "Доля 5xx (2m)",
|
||||
"description": "SLI доступности: 5xx / все бизнес-запросы без /health/*. Неверный пароль (401) не считается отказом.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "messenger:http_errors:ratio_rate2m",
|
||||
"legendFormat": "__auto",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit",
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "orange",
|
||||
"value": 0.01
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 0.05
|
||||
}
|
||||
]
|
||||
},
|
||||
"decimals": 2
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"colorMode": "value",
|
||||
"graphMode": "area",
|
||||
"textMode": "auto"
|
||||
},
|
||||
"id": 2,
|
||||
"gridPos": {
|
||||
"x": 6,
|
||||
"y": 0,
|
||||
"w": 6,
|
||||
"h": 4
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "stat",
|
||||
"title": "p95 latency (5m)",
|
||||
"description": "histogram_quantile по сумме buckets всех реплик, не среднее p95.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "messenger:http_request_duration_seconds:p95_5m",
|
||||
"legendFormat": "__auto",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s",
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "orange",
|
||||
"value": 0.3
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 0.5
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"colorMode": "value",
|
||||
"graphMode": "area",
|
||||
"textMode": "auto"
|
||||
},
|
||||
"id": 3,
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 0,
|
||||
"w": 6,
|
||||
"h": 4
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "stat",
|
||||
"title": "Доля не-5xx (окно 1h)",
|
||||
"description": "Доля не-5xx бизнес-запросов за 1h; цель 99%.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "1 - messenger:http_errors:ratio_rate1h",
|
||||
"legendFormat": "__auto",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit",
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"decimals": 3
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"colorMode": "value",
|
||||
"graphMode": "area",
|
||||
"textMode": "auto"
|
||||
},
|
||||
"id": 4,
|
||||
"gridPos": {
|
||||
"x": 18,
|
||||
"y": 0,
|
||||
"w": 6,
|
||||
"h": 4
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "row",
|
||||
"title": "Rate / Errors / Duration по endpoint",
|
||||
"collapsed": false,
|
||||
"panels": [],
|
||||
"id": 5,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 4,
|
||||
"w": 24,
|
||||
"h": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"title": "RPS по маршруту и классу статуса",
|
||||
"description": "Recording rule messenger:http_requests:rate2m; status class выводится из http.response.status_code.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "sum by (http_route, http_request_method, status_class) (messenger:http_requests:rate2m{http_route=~\"$route\"})",
|
||||
"legendFormat": "{{http_request_method}} {{http_route}} {{status_class}}",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "reqps",
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 1,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"mode": "none",
|
||||
"group": "A"
|
||||
}
|
||||
},
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "table",
|
||||
"placement": "bottom",
|
||||
"calcs": [
|
||||
"lastNotNull",
|
||||
"max"
|
||||
]
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "desc"
|
||||
}
|
||||
},
|
||||
"id": 6,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 5,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"title": "Доля ошибок",
|
||||
"description": "Числитель SLI — только 5xx; 4xx показаны отдельно и в SLO не входят.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "(sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\", http_route=~\"$route\", instance=~\"$instance\", http_response_status_code=~\"5..\"}[$__rate_interval])) or vector(0)) / sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\", http_route=~\"$route\", instance=~\"$instance\"}[$__rate_interval]))",
|
||||
"legendFormat": "5xx / все (SLI)",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "B",
|
||||
"expr": "(sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\", http_route=~\"$route\", instance=~\"$instance\", http_response_status_code=~\"4..\"}[$__rate_interval])) or vector(0)) / sum(rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\", http_route=~\"$route\", instance=~\"$instance\"}[$__rate_interval]))",
|
||||
"legendFormat": "4xx / все (клиент)",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit",
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 1,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"mode": "none",
|
||||
"group": "A"
|
||||
}
|
||||
},
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "table",
|
||||
"placement": "bottom",
|
||||
"calcs": [
|
||||
"lastNotNull",
|
||||
"max"
|
||||
]
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "desc"
|
||||
}
|
||||
},
|
||||
"id": 7,
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 5,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"title": "Latency p50 / p95 / p99",
|
||||
"description": "Из histogram buckets (секунды) всех выбранных реплик; exemplars ведут в Tempo.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "histogram_quantile(0.5, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\", http_route!~\"/health/.*\", http_route=~\"$route\", instance=~\"$instance\"}[$__rate_interval])))",
|
||||
"legendFormat": "p50",
|
||||
"range": true,
|
||||
"exemplar": true
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "B",
|
||||
"expr": "histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\", http_route!~\"/health/.*\", http_route=~\"$route\", instance=~\"$instance\"}[$__rate_interval])))",
|
||||
"legendFormat": "p95",
|
||||
"range": true,
|
||||
"exemplar": true
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "C",
|
||||
"expr": "histogram_quantile(0.99, sum by (le) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\", http_route!~\"/health/.*\", http_route=~\"$route\", instance=~\"$instance\"}[$__rate_interval])))",
|
||||
"legendFormat": "p99",
|
||||
"range": true,
|
||||
"exemplar": true
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s",
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 1,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"mode": "none",
|
||||
"group": "A"
|
||||
}
|
||||
},
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "table",
|
||||
"placement": "bottom",
|
||||
"calcs": [
|
||||
"lastNotNull",
|
||||
"max"
|
||||
]
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "desc"
|
||||
}
|
||||
},
|
||||
"id": 8,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 13,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"title": "p95 по маршруту",
|
||||
"description": "",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "histogram_quantile(0.95, sum by (le, http_route) (rate(http_server_request_duration_seconds_bucket{job=\"messenger-api\", http_route!~\"/health/.*\", http_route=~\"$route\", instance=~\"$instance\"}[$__rate_interval])))",
|
||||
"legendFormat": "{{http_route}}",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s",
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 1,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"mode": "none",
|
||||
"group": "A"
|
||||
}
|
||||
},
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "table",
|
||||
"placement": "bottom",
|
||||
"calcs": [
|
||||
"lastNotNull",
|
||||
"max"
|
||||
]
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "desc"
|
||||
}
|
||||
},
|
||||
"id": 9,
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 13,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"title": "RPS по реплике",
|
||||
"description": "instance = service.instance.id (реплика + pid процесса gunicorn).",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "sum by (instance) (rate(http_server_request_duration_seconds_count{job=\"messenger-api\", http_route!~\"/health/.*\", http_route=~\"$route\", instance=~\"$instance\"}[$__rate_interval]))",
|
||||
"legendFormat": "{{instance}}",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "reqps",
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 1,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"mode": "none",
|
||||
"group": "A"
|
||||
}
|
||||
},
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "table",
|
||||
"placement": "bottom",
|
||||
"calcs": [
|
||||
"lastNotNull",
|
||||
"max"
|
||||
]
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "desc"
|
||||
}
|
||||
},
|
||||
"id": 10,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 21,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"title": "Активные запросы",
|
||||
"description": "",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "sum by (instance) (http_server_active_requests{job=\"messenger-api\"})",
|
||||
"legendFormat": "{{instance}}",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short",
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 1,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"mode": "none",
|
||||
"group": "A"
|
||||
}
|
||||
},
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "table",
|
||||
"placement": "bottom",
|
||||
"calcs": [
|
||||
"lastNotNull",
|
||||
"max"
|
||||
]
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "desc"
|
||||
}
|
||||
},
|
||||
"id": 11,
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 21,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "row",
|
||||
"title": "Логи и трассы API",
|
||||
"collapsed": false,
|
||||
"panels": [],
|
||||
"id": 12,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 29,
|
||||
"w": 24,
|
||||
"h": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "logs",
|
||||
"title": "Логи API (ошибки и предупреждения)",
|
||||
"datasource": {
|
||||
"type": "loki",
|
||||
"uid": "loki"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "loki",
|
||||
"uid": "loki"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "{service_name=\"messenger-api\"} | severity_text=~\"(?i)error|warn.*\"",
|
||||
"queryType": "range"
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"showTime": true,
|
||||
"wrapLogMessage": true,
|
||||
"sortOrder": "Descending",
|
||||
"enableLogDetails": true,
|
||||
"dedupStrategy": "none",
|
||||
"prettifyLogMessage": false
|
||||
},
|
||||
"id": 13,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 30,
|
||||
"w": 12,
|
||||
"h": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "table",
|
||||
"title": "Трассы API с ошибкой",
|
||||
"datasource": {
|
||||
"type": "tempo",
|
||||
"uid": "tempo"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "tempo",
|
||||
"uid": "tempo"
|
||||
},
|
||||
"refId": "A",
|
||||
"queryType": "traceql",
|
||||
"query": "{ resource.service.name = \"messenger-api\" && status = error }",
|
||||
"limit": 20,
|
||||
"tableType": "traces"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {},
|
||||
"id": 14,
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 30,
|
||||
"w": 12,
|
||||
"h": 10
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,569 @@
|
||||
{
|
||||
"uid": "messenger-pipeline",
|
||||
"title": "Messenger · Worker",
|
||||
"description": "Задания worker: исходы, длительность обработки, логи и трассы.",
|
||||
"tags": [
|
||||
"messenger",
|
||||
"lab6",
|
||||
"worker"
|
||||
],
|
||||
"timezone": "browser",
|
||||
"editable": false,
|
||||
"graphTooltip": 1,
|
||||
"refresh": "10s",
|
||||
"schemaVersion": 41,
|
||||
"version": 2,
|
||||
"time": {
|
||||
"from": "now-30m",
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {},
|
||||
"fiscalYearStartMonth": 0,
|
||||
"liveNow": false,
|
||||
"links": [
|
||||
{
|
||||
"title": "Messenger",
|
||||
"type": "dashboards",
|
||||
"tags": [
|
||||
"messenger"
|
||||
],
|
||||
"asDropdown": true,
|
||||
"includeVars": false,
|
||||
"keepTime": true
|
||||
}
|
||||
],
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"builtIn": 1,
|
||||
"datasource": {
|
||||
"type": "grafana",
|
||||
"uid": "-- Grafana --"
|
||||
},
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"type": "dashboard"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"enable": true,
|
||||
"iconColor": "red",
|
||||
"name": "Firing alerts",
|
||||
"expr": "ALERTS{alertstate=\"firing\"}",
|
||||
"step": "15s",
|
||||
"titleFormat": "{{alertname}}",
|
||||
"textFormat": "{{alertname}} firing",
|
||||
"useValueForTime": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"templating": {
|
||||
"list": []
|
||||
},
|
||||
"panels": [
|
||||
{
|
||||
"type": "row",
|
||||
"title": "Worker",
|
||||
"collapsed": false,
|
||||
"panels": [],
|
||||
"id": 8,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 24,
|
||||
"h": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"title": "Jobs по исходу",
|
||||
"description": "",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "sum by (job_type, outcome) (rate(messenger_jobs_processed_total[$__rate_interval]))",
|
||||
"legendFormat": "{{job_type}} {{outcome}}",
|
||||
"range": true,
|
||||
"exemplar": false
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "ops",
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 1,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"mode": "normal",
|
||||
"group": "A"
|
||||
}
|
||||
},
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "table",
|
||||
"placement": "bottom",
|
||||
"calcs": [
|
||||
"lastNotNull",
|
||||
"max"
|
||||
]
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "desc"
|
||||
}
|
||||
},
|
||||
"id": 9,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 1,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "timeseries",
|
||||
"title": "Длительность обработки job",
|
||||
"description": "",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "histogram_quantile(0.5, sum by (le, job_type) (rate(messenger_job_duration_seconds_bucket{}[$__rate_interval])))",
|
||||
"legendFormat": "p50 {{job_type}}",
|
||||
"range": true,
|
||||
"exemplar": true
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "B",
|
||||
"expr": "histogram_quantile(0.95, sum by (le, job_type) (rate(messenger_job_duration_seconds_bucket{}[$__rate_interval])))",
|
||||
"legendFormat": "p95 {{job_type}}",
|
||||
"range": true,
|
||||
"exemplar": true
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"refId": "C",
|
||||
"expr": "histogram_quantile(0.99, sum by (le, job_type) (rate(messenger_job_duration_seconds_bucket{}[$__rate_interval])))",
|
||||
"legendFormat": "p99 {{job_type}}",
|
||||
"range": true,
|
||||
"exemplar": true
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s",
|
||||
"custom": {
|
||||
"drawStyle": "line",
|
||||
"lineWidth": 1,
|
||||
"fillOpacity": 10,
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"mode": "none",
|
||||
"group": "A"
|
||||
}
|
||||
},
|
||||
"min": 0
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "table",
|
||||
"placement": "bottom",
|
||||
"calcs": [
|
||||
"lastNotNull",
|
||||
"max"
|
||||
]
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "multi",
|
||||
"sort": "desc"
|
||||
}
|
||||
},
|
||||
"id": 10,
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 1,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "row",
|
||||
"title": "Логи и трассы worker",
|
||||
"collapsed": false,
|
||||
"panels": [],
|
||||
"id": 13,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 9,
|
||||
"w": 24,
|
||||
"h": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "logs",
|
||||
"title": "Логи worker",
|
||||
"datasource": {
|
||||
"type": "loki",
|
||||
"uid": "loki"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "loki",
|
||||
"uid": "loki"
|
||||
},
|
||||
"refId": "A",
|
||||
"expr": "{service_name=\"messenger-worker\"}",
|
||||
"queryType": "range"
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"showTime": true,
|
||||
"wrapLogMessage": true,
|
||||
"sortOrder": "Descending",
|
||||
"enableLogDetails": true,
|
||||
"dedupStrategy": "none",
|
||||
"prettifyLogMessage": false
|
||||
},
|
||||
"id": 14,
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 10,
|
||||
"w": 12,
|
||||
"h": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "table",
|
||||
"title": "Трассы worker",
|
||||
"datasource": {
|
||||
"type": "tempo",
|
||||
"uid": "tempo"
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "tempo",
|
||||
"uid": "tempo"
|
||||
},
|
||||
"refId": "A",
|
||||
"queryType": "traceql",
|
||||
"query": "{ resource.service.name = \"messenger-worker\" }",
|
||||
"limit": 20,
|
||||
"tableType": "traces"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {},
|
||||
"id": 15,
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 10,
|
||||
"w": 12,
|
||||
"h": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 16,
|
||||
"type": "timeseries",
|
||||
"title": "Durable queue depth (includes retry)",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 20,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "max(messenger_queue_depth)",
|
||||
"legendFormat": "{{job}} {{__name__}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 17,
|
||||
"type": "timeseries",
|
||||
"title": "Oldest durable job age",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 20,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "max(messenger_queue_oldest_age_seconds)",
|
||||
"legendFormat": "{{job}} {{__name__}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 18,
|
||||
"type": "timeseries",
|
||||
"title": "DB pool used / waiting / capacity",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 28,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum by (__name__,job) ({__name__=~\"messenger_db_pool_(used|waiting|capacity)\"})",
|
||||
"legendFormat": "{{job}} {{__name__}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 19,
|
||||
"type": "timeseries",
|
||||
"title": "Worker busy / capacity",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 28,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum by (__name__) ({__name__=~\"messenger_worker_(busy|capacity)\"})",
|
||||
"legendFormat": "{{job}} {{__name__}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 20,
|
||||
"type": "timeseries",
|
||||
"title": "Process CPU cores",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 36,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum by (job) (rate(process_cpu_time_seconds_total{job=~\"messenger-.*\"}[1m]))",
|
||||
"legendFormat": "{{job}} {{__name__}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 21,
|
||||
"type": "timeseries",
|
||||
"title": "Process resident memory",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 36,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum by (job) (process_memory_usage_bytes{job=~\"messenger-.*\"})",
|
||||
"legendFormat": "{{job}} {{__name__}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "bytes"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 22,
|
||||
"type": "timeseries",
|
||||
"title": "Time to ready p50 / p95 / p99",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 44,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "histogram_quantile(0.5,sum by (le) (rate(messenger_job_time_to_ready_seconds_bucket[5m])))",
|
||||
"legendFormat": "0.5"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "histogram_quantile(0.95,sum by (le) (rate(messenger_job_time_to_ready_seconds_bucket[5m])))",
|
||||
"legendFormat": "0.95"
|
||||
},
|
||||
{
|
||||
"refId": "C",
|
||||
"expr": "histogram_quantile(0.99,sum by (le) (rate(messenger_job_time_to_ready_seconds_bucket[5m])))",
|
||||
"legendFormat": "0.99"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 23,
|
||||
"type": "timeseries",
|
||||
"title": "Ready within 30s, SLO 95% / 1h",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 44,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "messenger:ready_under_30s:ratio1h",
|
||||
"legendFormat": "{{job}} {{__name__}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 24,
|
||||
"type": "timeseries",
|
||||
"title": "API availability, SLO 99% / 1h",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 52,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "messenger:availability:ratio1h",
|
||||
"legendFormat": "{{job}} {{__name__}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
apiVersion: 1
|
||||
@@ -0,0 +1,14 @@
|
||||
apiVersion: 1
|
||||
|
||||
providers:
|
||||
- name: messenger
|
||||
orgId: 1
|
||||
folder: Messenger
|
||||
folderUid: messenger
|
||||
type: file
|
||||
disableDeletion: true
|
||||
allowUiUpdates: false
|
||||
updateIntervalSeconds: 30
|
||||
options:
|
||||
path: /etc/grafana/dashboards
|
||||
foldersFromFilesStructure: false
|
||||
@@ -0,0 +1,79 @@
|
||||
apiVersion: 1
|
||||
|
||||
prune: true
|
||||
|
||||
datasources:
|
||||
- name: Prometheus
|
||||
uid: prometheus
|
||||
type: prometheus
|
||||
access: proxy
|
||||
url: http://127.0.0.1:19090
|
||||
isDefault: true
|
||||
editable: false
|
||||
jsonData:
|
||||
httpMethod: POST
|
||||
prometheusType: Prometheus
|
||||
prometheusVersion: 3.15.1
|
||||
timeInterval: 15s
|
||||
exemplarTraceIdDestinations:
|
||||
- name: trace_id
|
||||
datasourceUid: tempo
|
||||
urlDisplayLabel: Trace
|
||||
|
||||
- name: Loki
|
||||
uid: loki
|
||||
type: loki
|
||||
access: proxy
|
||||
url: http://127.0.0.1:13100
|
||||
editable: false
|
||||
jsonData:
|
||||
maxLines: 1000
|
||||
derivedFields:
|
||||
- name: TraceID
|
||||
matcherType: label
|
||||
matcherRegex: trace_id
|
||||
datasourceUid: tempo
|
||||
url: "$${__value.raw}"
|
||||
urlDisplayLabel: Trace
|
||||
|
||||
- name: Tempo
|
||||
uid: tempo
|
||||
type: tempo
|
||||
access: proxy
|
||||
url: http://127.0.0.1:13200
|
||||
editable: false
|
||||
jsonData:
|
||||
nodeGraph:
|
||||
enabled: true
|
||||
search:
|
||||
hide: false
|
||||
traceQuery:
|
||||
timeShiftEnabled: true
|
||||
spanStartTimeShift: -30m
|
||||
spanEndTimeShift: 30m
|
||||
streamingEnabled:
|
||||
search: true
|
||||
metrics: false
|
||||
tracesToLogsV2:
|
||||
datasourceUid: loki
|
||||
spanStartTimeShift: -5m
|
||||
spanEndTimeShift: 5m
|
||||
filterByTraceID: true
|
||||
filterBySpanID: false
|
||||
tags:
|
||||
- key: service.name
|
||||
value: service_name
|
||||
tracesToMetrics:
|
||||
datasourceUid: prometheus
|
||||
spanStartTimeShift: -5m
|
||||
spanEndTimeShift: 5m
|
||||
tags:
|
||||
- key: service.name
|
||||
value: job
|
||||
queries:
|
||||
- name: RPS маршрута
|
||||
query: sum(rate(http_server_request_duration_seconds_count{$$__tags}[1m]))
|
||||
- name: p95 маршрута
|
||||
query: histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{$$__tags}[5m])))
|
||||
lokiSearch:
|
||||
datasourceUid: loki
|
||||
@@ -0,0 +1,3 @@
|
||||
apiVersion: 1
|
||||
|
||||
apps: []
|
||||
@@ -0,0 +1,71 @@
|
||||
global
|
||||
log stdout format raw local0 info
|
||||
maxconn 4096
|
||||
hard-stop-after 5s
|
||||
tune.bufsize 32768
|
||||
tune.rcvbuf.client 65536
|
||||
tune.rcvbuf.server 65536
|
||||
tune.sndbuf.client 65536
|
||||
tune.sndbuf.server 65536
|
||||
|
||||
resolvers docker
|
||||
nameserver dns 127.0.0.11:53
|
||||
accepted_payload_size 8192
|
||||
resolve_retries 3
|
||||
timeout resolve 1s
|
||||
timeout retry 1s
|
||||
hold nx 2s
|
||||
hold other 2s
|
||||
hold refused 2s
|
||||
hold timeout 2s
|
||||
|
||||
defaults
|
||||
mode http
|
||||
log global
|
||||
option dontlognull
|
||||
option dontlog-normal
|
||||
log-format "%ci [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq rid=%[var(txn.request_id)] %HM %HPO"
|
||||
option http-server-close
|
||||
option redispatch 1
|
||||
retries 2
|
||||
retry-on conn-failure empty-response
|
||||
timeout connect 500ms
|
||||
timeout client 30s
|
||||
timeout server 10s
|
||||
timeout http-request 5s
|
||||
timeout http-keep-alive 5s
|
||||
timeout queue 3s
|
||||
timeout check 1s
|
||||
http-error status 502 content-type application/json hdr X-Request-Id "%[var(txn.request_id)]" lf-string '{"error":{"code":"unavailable","message":"Upstream replica failed","request_id":"%[var(txn.request_id),json(ascii)]"}}'
|
||||
http-error status 503 content-type application/json hdr X-Request-Id "%[var(txn.request_id)]" lf-string '{"error":{"code":"unavailable","message":"No ready API replica","request_id":"%[var(txn.request_id),json(ascii)]"}}'
|
||||
http-error status 504 content-type application/json hdr X-Request-Id "%[var(txn.request_id)]" lf-string '{"error":{"code":"unavailable","message":"Upstream timeout","request_id":"%[var(txn.request_id),json(ascii)]"}}'
|
||||
|
||||
frontend public
|
||||
bind :8443 ssl crt /run/pki/tls.pem
|
||||
option forwardfor
|
||||
http-request set-var(txn.request_id) req.fhdr(X-Request-Id) if { req.fhdr(X-Request-Id) -m len 1:200 }
|
||||
http-request set-var(txn.request_id) uuid(4) unless { var(txn.request_id) -m found }
|
||||
http-request set-header X-Request-Id %[var(txn.request_id)]
|
||||
default_backend api
|
||||
|
||||
backend api
|
||||
balance roundrobin
|
||||
option httpchk
|
||||
http-check send meth GET uri /health/ready ver HTTP/1.1 hdr Host lb
|
||||
http-check expect status 200
|
||||
acl message_path path_reg ^/api/v1/chats/[^/]+/messages$
|
||||
acl has_key req.hdr(Idempotency-Key) -m found
|
||||
http-request set-var(txn.replay_safe) bool(1) if METH_GET
|
||||
http-request set-var(txn.replay_safe) bool(1) if METH_POST message_path has_key
|
||||
http-request disable-l7-retry unless { var(txn.replay_safe) -m bool }
|
||||
default-server check init-state fully-down inter 1s fastinter 500ms downinter 2s fall 2 rise 2 resolvers docker resolve-prefer ipv4 init-addr none maxconn "${API_SERVER_MAXCONN-64}"
|
||||
server-template api 8 api:8443 ssl verify required ca-file /run/pki/ca.crt crt /run/pki/tls.pem verifyhost api sni str(api)
|
||||
|
||||
frontend stats
|
||||
bind 127.0.0.1:8404
|
||||
monitor-uri /healthz
|
||||
monitor fail if { nbsrv(api) lt 1 }
|
||||
http-request use-service prometheus-exporter if { path /metrics }
|
||||
stats enable
|
||||
stats uri /stats
|
||||
stats refresh 5s
|
||||
@@ -0,0 +1,106 @@
|
||||
import http from 'k6/http';
|
||||
import { check } from 'k6';
|
||||
import encoding from 'k6/encoding';
|
||||
import exec from 'k6/execution';
|
||||
|
||||
const BASE = __ENV.BASE_URL || 'http://lb:8080';
|
||||
const RATE = Number(__ENV.RATE || 50);
|
||||
const WARMUP = Number(__ENV.WARMUP || 10);
|
||||
const DURATION = Number(__ENV.DURATION || 60);
|
||||
const USERS = Math.max(2, Number(__ENV.USERS || 20));
|
||||
const READ_RATIO = Number(__ENV.READ_RATIO || 0.2);
|
||||
const VUS = Number(__ENV.VUS || Math.max(10, Math.ceil(RATE / 10)));
|
||||
const MAX_VUS = Number(__ENV.MAX_VUS || Math.max(VUS, Math.min(VUS * 4, 1000)));
|
||||
const RUN = __ENV.RUN_ID || Date.now().toString(36);
|
||||
const SUMMARY = __ENV.SUMMARY || '/out/summary.json';
|
||||
const JSON_HEADERS = { 'Content-Type': 'application/json' };
|
||||
|
||||
const phase = (startTime, duration) => ({
|
||||
executor: 'constant-arrival-rate',
|
||||
rate: RATE,
|
||||
timeUnit: '1s',
|
||||
startTime: `${startTime}s`,
|
||||
duration: `${duration}s`,
|
||||
preAllocatedVUs: VUS,
|
||||
maxVUs: MAX_VUS,
|
||||
gracefulStop: '5s',
|
||||
});
|
||||
|
||||
const measured = ['http_reqs', 'http_req_failed', 'http_req_duration', 'dropped_iterations', 'iterations'];
|
||||
|
||||
export const options = {
|
||||
setupTimeout: '180s',
|
||||
summaryTrendStats: ['avg', 'min', 'med', 'p(90)', 'p(95)', 'p(99)', 'max'],
|
||||
scenarios: Object.assign(WARMUP > 0 ? { warmup: phase(0, WARMUP) } : {}, { measure: phase(WARMUP, DURATION) }),
|
||||
thresholds: Object.fromEntries([
|
||||
...measured.map((metric) => [`${metric}{scenario:measure}`, []]),
|
||||
['http_req_duration{scenario:measure,name:post_message}', []],
|
||||
['http_req_duration{scenario:measure,name:get_history}', []],
|
||||
]),
|
||||
};
|
||||
|
||||
function created(response, what) {
|
||||
if (response.status !== 201) {
|
||||
throw new Error(`${what}: HTTP ${response.status}`);
|
||||
}
|
||||
return response.json();
|
||||
}
|
||||
|
||||
const bearer = (token, extra) => Object.assign({ Authorization: `Bearer ${token}` }, extra || {});
|
||||
|
||||
export function setup() {
|
||||
const actors = [];
|
||||
for (let i = 0; i < USERS; i++) {
|
||||
const username = `k6_${RUN}_${i}`.slice(0, 32);
|
||||
const password = `K6-${RUN}-${i}-synthetic`;
|
||||
const user = created(
|
||||
http.post(`${BASE}/api/v1/users`, JSON.stringify({ username, display_name: `k6 ${i}`, password }), { headers: JSON_HEADERS }),
|
||||
'register',
|
||||
);
|
||||
const basic = encoding.b64encode(`${username}:${password}`);
|
||||
const session = created(
|
||||
http.post(`${BASE}/api/v1/auth/sessions`, null, { headers: { Authorization: `Basic ${basic}` } }),
|
||||
'login',
|
||||
);
|
||||
actors.push({ id: user.id, token: session.token });
|
||||
}
|
||||
const chats = [];
|
||||
for (let i = 0; i < USERS; i += 2) {
|
||||
const [a, b] = [actors[i], actors[(i + 1) % USERS]];
|
||||
const body = JSON.stringify({ title: `k6 ${RUN} ${i}`, member_ids: [a.id, b.id] });
|
||||
const chat = created(http.post(`${BASE}/api/v1/chats`, body, { headers: bearer(a.token, JSON_HEADERS) }), 'chat');
|
||||
chats.push({ id: chat.id, tokens: [a.token, b.token] });
|
||||
}
|
||||
console.log('LOAD-START');
|
||||
return { chats };
|
||||
}
|
||||
|
||||
export default function (data) {
|
||||
const n = exec.scenario.iterationInTest;
|
||||
const chat = data.chats[n % data.chats.length];
|
||||
const token = chat.tokens[Math.floor(n / data.chats.length) % 2];
|
||||
if (Math.random() < READ_RATIO) {
|
||||
const response = http.get(`${BASE}/api/v1/chats/${chat.id}/messages?limit=50`, {
|
||||
headers: bearer(token),
|
||||
tags: { name: 'get_history' },
|
||||
timeout: '10s',
|
||||
});
|
||||
check(response, { 'history 200': (r) => r.status === 200 });
|
||||
return;
|
||||
}
|
||||
const key = `${RUN}-${exec.scenario.name}-${n}`;
|
||||
const response = http.post(`${BASE}/api/v1/chats/${chat.id}/messages`, JSON.stringify({ text: `k6 ${key}` }), {
|
||||
headers: bearer(token, Object.assign({ 'Idempotency-Key': key }, JSON_HEADERS)),
|
||||
tags: { name: 'post_message' },
|
||||
timeout: '10s',
|
||||
});
|
||||
check(response, { 'message 201': (r) => r.status === 201 });
|
||||
}
|
||||
|
||||
export function handleSummary(data) {
|
||||
delete data.setup_data;
|
||||
const reqs = data.metrics['http_reqs{scenario:measure}'];
|
||||
const failed = data.metrics['http_req_failed{scenario:measure}'];
|
||||
const line = `measure: ${reqs ? reqs.values.count : 0} requests, failed ratio ${failed ? failed.values.rate : 'n/a'}\n`;
|
||||
return { [SUMMARY]: JSON.stringify(data, null, 1), stdout: line };
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
auth_enabled: false
|
||||
|
||||
server:
|
||||
http_listen_address: 127.0.0.1
|
||||
http_listen_port: 3100
|
||||
grpc_listen_address: 127.0.0.1
|
||||
grpc_listen_port: 9096
|
||||
log_level: warn
|
||||
|
||||
common:
|
||||
instance_addr: 127.0.0.1
|
||||
path_prefix: /loki
|
||||
replication_factor: 1
|
||||
storage:
|
||||
filesystem:
|
||||
chunks_directory: /loki/chunks
|
||||
rules_directory: /loki/rules
|
||||
ring:
|
||||
kvstore:
|
||||
store: inmemory
|
||||
|
||||
schema_config:
|
||||
configs:
|
||||
- from: "2026-01-01"
|
||||
store: tsdb
|
||||
object_store: filesystem
|
||||
schema: v13
|
||||
index:
|
||||
prefix: index_
|
||||
period: 24h
|
||||
|
||||
ingester:
|
||||
chunk_idle_period: 5m
|
||||
max_chunk_age: 1h
|
||||
|
||||
limits_config:
|
||||
allow_structured_metadata: true
|
||||
volume_enabled: true
|
||||
retention_period: 168h
|
||||
reject_old_samples: true
|
||||
reject_old_samples_max_age: 24h
|
||||
ingestion_rate_mb: 8
|
||||
ingestion_burst_size_mb: 16
|
||||
max_query_lookback: 168h
|
||||
otlp_config:
|
||||
resource_attributes:
|
||||
ignore_defaults: true
|
||||
attributes_config:
|
||||
- action: index_label
|
||||
attributes:
|
||||
- service.name
|
||||
- deployment.environment.name
|
||||
- action: structured_metadata
|
||||
attributes:
|
||||
- service.instance.id
|
||||
- service.version
|
||||
|
||||
compactor:
|
||||
working_directory: /loki/compactor
|
||||
retention_enabled: true
|
||||
delete_request_store: filesystem
|
||||
compaction_interval: 10m
|
||||
|
||||
query_range:
|
||||
results_cache:
|
||||
cache:
|
||||
embedded_cache:
|
||||
enabled: true
|
||||
max_size_mb: 64
|
||||
|
||||
pattern_ingester:
|
||||
enabled: false
|
||||
|
||||
ruler:
|
||||
enable_api: false
|
||||
|
||||
analytics:
|
||||
reporting_enabled: false
|
||||
@@ -0,0 +1 @@
|
||||
path "secret/data/api" { capabilities = ["read"] }
|
||||
@@ -0,0 +1 @@
|
||||
path "secret/data/migrate" { capabilities = ["read"] }
|
||||
@@ -0,0 +1 @@
|
||||
path "secret/data/reconciler" { capabilities = ["read"] }
|
||||
@@ -0,0 +1 @@
|
||||
path "secret/data/relay" { capabilities = ["read"] }
|
||||
@@ -0,0 +1,14 @@
|
||||
ui = true
|
||||
api_addr = "https://openbao:8200"
|
||||
cluster_addr = "https://openbao:8201"
|
||||
storage "raft" {
|
||||
node_id = "lab7"
|
||||
path = "/bao/data"
|
||||
}
|
||||
listener "tcp" {
|
||||
address = "0.0.0.0:8200"
|
||||
tls_cert_file = "/run/pki/tls.crt"
|
||||
tls_key_file = "/run/pki/tls.key"
|
||||
tls_client_ca_file = "/run/pki/ca.crt"
|
||||
tls_min_version = "tls12"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
path "secret/data/worker" { capabilities = ["read"] }
|
||||
@@ -0,0 +1,122 @@
|
||||
extensions:
|
||||
health_check:
|
||||
endpoint: 0.0.0.0:13133
|
||||
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
max_request_body_size: 8388608
|
||||
|
||||
processors:
|
||||
tail_sampling:
|
||||
decision_wait: 10s
|
||||
num_traces: 2000
|
||||
expected_new_traces_per_sec: 30
|
||||
decision_cache:
|
||||
sampled_cache_size: 10000
|
||||
non_sampled_cache_size: 10000
|
||||
policies:
|
||||
- name: errors
|
||||
type: status_code
|
||||
status_code: {status_codes: [ERROR]}
|
||||
- name: slow
|
||||
type: latency
|
||||
latency: {threshold_ms: 300}
|
||||
- name: baseline
|
||||
type: probabilistic
|
||||
probabilistic: {sampling_percentage: 5}
|
||||
memory_limiter:
|
||||
check_interval: 1s
|
||||
limit_percentage: 75
|
||||
spike_limit_percentage: 20
|
||||
redaction:
|
||||
allow_all_keys: true
|
||||
summary: silent
|
||||
blocked_key_patterns:
|
||||
- "(?i)^(.*[._-])?(password|passwd|secret|token|authorization|cookie|api[._-]?key|private[._-]?key|credentials?)$"
|
||||
- "^http\\.(request|response)\\.header\\..+"
|
||||
- "^url\\.(query|full)$"
|
||||
- "^http\\.(url|target)$"
|
||||
- "^(messenger\\.)?(message\\.)?(text|body)$"
|
||||
- "^(file\\.)?filename$"
|
||||
blocked_values:
|
||||
- "(?i)bearer\\s+[A-Za-z0-9._~+/=-]{8,}"
|
||||
- "(?i)basic\\s+[A-Za-z0-9+/=]{8,}"
|
||||
- "(?i)x-amz-(signature|credential)=[^&\\s]+"
|
||||
- "-----BEGIN [A-Z ]*PRIVATE KEY-----"
|
||||
batch:
|
||||
send_batch_size: 1024
|
||||
send_batch_max_size: 2048
|
||||
timeout: 2s
|
||||
|
||||
exporters:
|
||||
otlp_http/tempo:
|
||||
traces_endpoint: http://tempo:4318/v1/traces
|
||||
timeout: 5s
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
sizer: items
|
||||
queue_size: 20000
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 10s
|
||||
max_elapsed_time: 60s
|
||||
otlp_http/prometheus:
|
||||
metrics_endpoint: http://prometheus:9090/api/v1/otlp/v1/metrics
|
||||
timeout: 5s
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
sizer: items
|
||||
queue_size: 50000
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 10s
|
||||
max_elapsed_time: 60s
|
||||
otlp_http/loki:
|
||||
logs_endpoint: http://loki:3100/otlp/v1/logs
|
||||
timeout: 5s
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
sizer: items
|
||||
queue_size: 20000
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 10s
|
||||
max_elapsed_time: 60s
|
||||
|
||||
service:
|
||||
extensions: [health_check]
|
||||
telemetry:
|
||||
logs:
|
||||
level: info
|
||||
metrics:
|
||||
level: normal
|
||||
readers:
|
||||
- pull:
|
||||
exporter:
|
||||
prometheus:
|
||||
host: 0.0.0.0
|
||||
port: 8888
|
||||
without_type_suffix: false
|
||||
without_units: false
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, redaction, tail_sampling, batch]
|
||||
exporters: [otlp_http/tempo]
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, redaction, batch]
|
||||
exporters: [otlp_http/prometheus]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, redaction, batch]
|
||||
exporters: [otlp_http/loki]
|
||||
@@ -0,0 +1,122 @@
|
||||
extensions:
|
||||
health_check:
|
||||
endpoint: 0.0.0.0:13133
|
||||
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
max_request_body_size: 8388608
|
||||
|
||||
processors:
|
||||
tail_sampling:
|
||||
decision_wait: 10s
|
||||
num_traces: 2000
|
||||
expected_new_traces_per_sec: 30
|
||||
decision_cache:
|
||||
sampled_cache_size: 10000
|
||||
non_sampled_cache_size: 10000
|
||||
policies:
|
||||
- name: errors
|
||||
type: status_code
|
||||
status_code: {status_codes: [ERROR]}
|
||||
- name: slow
|
||||
type: latency
|
||||
latency: {threshold_ms: 300}
|
||||
- name: baseline
|
||||
type: probabilistic
|
||||
probabilistic: {sampling_percentage: 10}
|
||||
memory_limiter:
|
||||
check_interval: 1s
|
||||
limit_percentage: 75
|
||||
spike_limit_percentage: 20
|
||||
redaction:
|
||||
allow_all_keys: true
|
||||
summary: silent
|
||||
blocked_key_patterns:
|
||||
- "(?i)^(.*[._-])?(password|passwd|secret|token|authorization|cookie|api[._-]?key|private[._-]?key|credentials?)$"
|
||||
- "^http\\.(request|response)\\.header\\..+"
|
||||
- "^url\\.(query|full)$"
|
||||
- "^http\\.(url|target)$"
|
||||
- "^(messenger\\.)?(message\\.)?(text|body)$"
|
||||
- "^(file\\.)?filename$"
|
||||
blocked_values:
|
||||
- "(?i)bearer\\s+[A-Za-z0-9._~+/=-]{8,}"
|
||||
- "(?i)basic\\s+[A-Za-z0-9+/=]{8,}"
|
||||
- "(?i)x-amz-(signature|credential)=[^&\\s]+"
|
||||
- "-----BEGIN [A-Z ]*PRIVATE KEY-----"
|
||||
batch:
|
||||
send_batch_size: 1024
|
||||
send_batch_max_size: 2048
|
||||
timeout: 2s
|
||||
|
||||
exporters:
|
||||
otlp_http/tempo:
|
||||
traces_endpoint: http://tempo:4318/v1/traces
|
||||
timeout: 5s
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
sizer: items
|
||||
queue_size: 20000
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 10s
|
||||
max_elapsed_time: 60s
|
||||
otlp_http/prometheus:
|
||||
metrics_endpoint: http://prometheus:9090/api/v1/otlp/v1/metrics
|
||||
timeout: 5s
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
sizer: items
|
||||
queue_size: 50000
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 10s
|
||||
max_elapsed_time: 60s
|
||||
otlp_http/loki:
|
||||
logs_endpoint: http://loki:3100/otlp/v1/logs
|
||||
timeout: 5s
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
sizer: items
|
||||
queue_size: 20000
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 10s
|
||||
max_elapsed_time: 60s
|
||||
|
||||
service:
|
||||
extensions: [health_check]
|
||||
telemetry:
|
||||
logs:
|
||||
level: info
|
||||
metrics:
|
||||
level: normal
|
||||
readers:
|
||||
- pull:
|
||||
exporter:
|
||||
prometheus:
|
||||
host: 0.0.0.0
|
||||
port: 8888
|
||||
without_type_suffix: false
|
||||
without_units: false
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, redaction, tail_sampling, batch]
|
||||
exporters: [otlp_http/tempo]
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, redaction, batch]
|
||||
exporters: [otlp_http/prometheus]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, redaction, batch]
|
||||
exporters: [otlp_http/loki]
|
||||
@@ -0,0 +1,129 @@
|
||||
extensions:
|
||||
health_check:
|
||||
endpoint: 127.0.0.1:13133
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
http:
|
||||
endpoint: 127.0.0.1:4318
|
||||
max_request_body_size: 8388608
|
||||
processors:
|
||||
memory_limiter:
|
||||
check_interval: 1s
|
||||
limit_percentage: 75
|
||||
spike_limit_percentage: 20
|
||||
redaction:
|
||||
allow_all_keys: true
|
||||
summary: silent
|
||||
blocked_key_patterns:
|
||||
- (?i)^(.*[._-])?(password|passwd|secret|token|authorization|cookie|api[._-]?key|private[._-]?key|credentials?)$
|
||||
- ^http\.(request|response)\.header\..+
|
||||
- ^url\.(query|full)$
|
||||
- ^http\.(url|target)$
|
||||
- ^(messenger\.)?(message\.)?(text|body)$
|
||||
- ^(file\.)?filename$
|
||||
blocked_values:
|
||||
- (?i)bearer\s+[A-Za-z0-9._~+/=-]{8,}
|
||||
- (?i)basic\s+[A-Za-z0-9+/=]{8,}
|
||||
- (?i)x-amz-(signature|credential)=[^&\s]+
|
||||
- '-----BEGIN [A-Z ]*PRIVATE KEY-----'
|
||||
batch:
|
||||
send_batch_size: 1024
|
||||
send_batch_max_size: 2048
|
||||
timeout: 2s
|
||||
exporters:
|
||||
otlp_http/tempo:
|
||||
traces_endpoint: https://tempo:44318/v1/traces
|
||||
timeout: 5s
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
sizer: items
|
||||
queue_size: 20000
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 10s
|
||||
max_elapsed_time: 60s
|
||||
tls:
|
||||
ca_file: /run/pki/ca.crt
|
||||
cert_file: /run/pki/tls.crt
|
||||
key_file: /run/pki/tls.key
|
||||
otlp_http/prometheus:
|
||||
metrics_endpoint: https://prometheus:9443/api/v1/otlp/v1/metrics
|
||||
timeout: 5s
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
sizer: items
|
||||
queue_size: 50000
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 10s
|
||||
max_elapsed_time: 60s
|
||||
tls:
|
||||
ca_file: /run/pki/ca.crt
|
||||
cert_file: /run/pki/tls.crt
|
||||
key_file: /run/pki/tls.key
|
||||
otlp_http/loki:
|
||||
logs_endpoint: https://loki:9443/otlp/v1/logs
|
||||
timeout: 5s
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
sizer: items
|
||||
queue_size: 20000
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 10s
|
||||
max_elapsed_time: 60s
|
||||
tls:
|
||||
ca_file: /run/pki/ca.crt
|
||||
cert_file: /run/pki/tls.crt
|
||||
key_file: /run/pki/tls.key
|
||||
service:
|
||||
extensions:
|
||||
- health_check
|
||||
telemetry:
|
||||
logs:
|
||||
level: info
|
||||
metrics:
|
||||
level: normal
|
||||
readers:
|
||||
- pull:
|
||||
exporter:
|
||||
prometheus:
|
||||
host: 127.0.0.1
|
||||
port: 8888
|
||||
without_type_suffix: false
|
||||
without_units: false
|
||||
pipelines:
|
||||
traces:
|
||||
receivers:
|
||||
- otlp
|
||||
processors:
|
||||
- memory_limiter
|
||||
- redaction
|
||||
- batch
|
||||
exporters:
|
||||
- otlp_http/tempo
|
||||
metrics:
|
||||
receivers:
|
||||
- otlp
|
||||
processors:
|
||||
- memory_limiter
|
||||
- redaction
|
||||
- batch
|
||||
exporters:
|
||||
- otlp_http/prometheus
|
||||
logs:
|
||||
receivers:
|
||||
- otlp
|
||||
processors:
|
||||
- memory_limiter
|
||||
- redaction
|
||||
- batch
|
||||
exporters:
|
||||
- otlp_http/loki
|
||||
@@ -0,0 +1,62 @@
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
scrape_timeout: 10s
|
||||
evaluation_interval: 15s
|
||||
rule_files:
|
||||
- /etc/prometheus/rules/*.yml
|
||||
otlp:
|
||||
translation_strategy: UnderscoreEscapingWithSuffixes
|
||||
promote_resource_attributes:
|
||||
- service.name
|
||||
- service.version
|
||||
- deployment.environment.name
|
||||
- container.name
|
||||
- compose.project
|
||||
- compose.service
|
||||
keep_identifying_resource_attributes: true
|
||||
storage:
|
||||
tsdb:
|
||||
out_of_order_time_window: 30m
|
||||
exemplars:
|
||||
max_exemplars: 100000
|
||||
scrape_configs:
|
||||
- job_name: prometheus
|
||||
static_configs:
|
||||
- targets:
|
||||
- localhost:9090
|
||||
- job_name: otel-collector
|
||||
static_configs:
|
||||
- targets:
|
||||
- otel-collector:48888
|
||||
scheme: https
|
||||
tls_config:
|
||||
ca_file: /run/pki/ca.crt
|
||||
cert_file: /run/pki/tls.crt
|
||||
key_file: /run/pki/tls.key
|
||||
- job_name: loki
|
||||
static_configs:
|
||||
- targets:
|
||||
- loki:9443
|
||||
scheme: https
|
||||
tls_config:
|
||||
ca_file: /run/pki/ca.crt
|
||||
cert_file: /run/pki/tls.crt
|
||||
key_file: /run/pki/tls.key
|
||||
- job_name: tempo
|
||||
static_configs:
|
||||
- targets:
|
||||
- tempo:9443
|
||||
scheme: https
|
||||
tls_config:
|
||||
ca_file: /run/pki/ca.crt
|
||||
cert_file: /run/pki/tls.crt
|
||||
key_file: /run/pki/tls.key
|
||||
- job_name: grafana
|
||||
static_configs:
|
||||
- targets:
|
||||
- grafana:9443
|
||||
scheme: https
|
||||
tls_config:
|
||||
ca_file: /run/pki/ca.crt
|
||||
cert_file: /run/pki/tls.crt
|
||||
key_file: /run/pki/tls.key
|
||||
@@ -0,0 +1,30 @@
|
||||
groups:
|
||||
- name: messenger-slo
|
||||
interval: 5s
|
||||
rules:
|
||||
- record: messenger:http_errors:ratio_rate1m
|
||||
expr: |
|
||||
(sum(rate(http_server_request_duration_seconds_count{job="messenger-api",http_route!~"/health/.*",http_response_status_code=~"5.."}[1m])) or vector(0))
|
||||
/ clamp_min(sum(rate(http_server_request_duration_seconds_count{job="messenger-api",http_route!~"/health/.*"}[1m])), 0.001)
|
||||
- record: messenger:availability:ratio1h
|
||||
expr: 1 - messenger:http_errors:ratio_rate1h
|
||||
- record: messenger:ready_under_30s:ratio1h
|
||||
expr: sum(increase(messenger_job_time_to_ready_seconds_bucket{le="30"}[1h])) / clamp_min(sum(increase(messenger_job_time_to_ready_seconds_count[1h])), 1)
|
||||
- alert: MessengerHighErrorRate
|
||||
expr: messenger:http_errors:ratio_rate1m > 0.05
|
||||
for: 15s
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
summary: More than 5% business HTTP 5xx over 1 minute
|
||||
description: Availability target is 99% over 1 hour; health and client 4xx are excluded from failures.
|
||||
runbook: infra/prometheus/runbooks.md#messengerhigherrorrate
|
||||
- alert: MessengerQueueLag
|
||||
expr: max(messenger_queue_oldest_age_seconds{queue_name="attachments.process"}) > 15 and max(messenger_queue_depth{queue_name="attachments.process"}) > 0
|
||||
for: 15s
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
summary: Durable attachment backlog has waited more than 15 seconds
|
||||
description: Target is 95% ready within 30 seconds over 1 hour; depth includes retry and leased work.
|
||||
runbook: infra/prometheus/runbooks.md#messengerqueuelag
|
||||
@@ -0,0 +1,32 @@
|
||||
groups:
|
||||
- name: messenger-http
|
||||
interval: 15s
|
||||
rules:
|
||||
- record: messenger:http_requests:rate2m
|
||||
expr: |
|
||||
sum by (http_route, http_request_method, status_class) (
|
||||
label_replace(
|
||||
rate(http_server_request_duration_seconds_count{job="messenger-api", http_route!~"/health/.*"}[2m]),
|
||||
"status_class", "${1}xx", "http_response_status_code", "([1-5])[0-9][0-9]"
|
||||
)
|
||||
)
|
||||
- record: messenger:http_errors:ratio_rate2m
|
||||
expr: |
|
||||
(sum(rate(http_server_request_duration_seconds_count{job="messenger-api", http_route!~"/health/.*", http_response_status_code=~"5.."}[2m])) or vector(0))
|
||||
/
|
||||
sum(rate(http_server_request_duration_seconds_count{job="messenger-api", http_route!~"/health/.*"}[2m]))
|
||||
- record: messenger:http_errors:ratio_rate1h
|
||||
expr: |
|
||||
(sum(rate(http_server_request_duration_seconds_count{job="messenger-api", http_route!~"/health/.*", http_response_status_code=~"5.."}[1h])) or vector(0))
|
||||
/
|
||||
sum(rate(http_server_request_duration_seconds_count{job="messenger-api", http_route!~"/health/.*"}[1h]))
|
||||
- record: messenger:http_request_duration_seconds:p50_5m
|
||||
expr: histogram_quantile(0.50, sum by (le) (rate(http_server_request_duration_seconds_bucket{job="messenger-api", http_route!~"/health/.*"}[5m])))
|
||||
- record: messenger:http_request_duration_seconds:p95_5m
|
||||
expr: histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{job="messenger-api", http_route!~"/health/.*"}[5m])))
|
||||
- record: messenger:http_request_duration_seconds:p99_5m
|
||||
expr: histogram_quantile(0.99, sum by (le) (rate(http_server_request_duration_seconds_bucket{job="messenger-api", http_route!~"/health/.*"}[5m])))
|
||||
- record: messenger:jobs:rate5m
|
||||
expr: sum by (job_type, outcome) (rate(messenger_jobs_processed_total[5m]))
|
||||
- record: messenger:job_duration_seconds:p95_5m
|
||||
expr: histogram_quantile(0.95, sum by (le, job_type) (rate(messenger_job_duration_seconds_bucket[5m])))
|
||||
@@ -0,0 +1,15 @@
|
||||
# Локальная диагностика
|
||||
|
||||
SLI availability = 1 − business HTTP 5xx / все business HTTP за 1 h, цель 99%; health исключены, 4xx остаются в знаменателе. SLI ready = доля завершённых jobs с time-to-ready <=30 s за 1 h, цель 95%. Незавершённые jobs не входят в histogram, поэтому возраст/depth контролируются отдельно. Учебные alerts реагируют раньше окна SLO: это пороговые предупреждения, не multi-window burn rates.
|
||||
|
||||
## MessengerHighErrorRate
|
||||
|
||||
Условие: 5xx/все >5% за 1 m непрерывно 15 s; вычисление каждые 5 s. В API dashboard проверить error ratio и p95. По request_id найти лог и trace. Длинный/ошибочный PostgreSQL client span указывает на зависимость; длинный server span без медленных client spans — на handler. Проверить used/waiting/capacity пула и ресурсы процесса. В своём стенде восстановить postgres, дождаться ready обеих API и успешных запросов. Alert должен исчезнуть после ухода ошибок из минутного окна.
|
||||
|
||||
## MessengerQueueLag
|
||||
|
||||
Условие: durable depth>0 и oldest age>15 s непрерывно 15 s. Проверить jobs outcomes, worker busy/capacity, CPU/RAM и наличие worker logs. Отсутствие worker signal при растущем backlog указывает на остановку процесса; retry с S3 ERROR spans — на хранилище. Проверить producer/consumer цепочку конкретного attachment. Восстановить только свой worker/зависимость; дождаться ready, depth=0, age=0 и отсутствия firing alert. Queue depth относится к PostgreSQL queued/processing, включая scheduled retry, а не только AMQP ready messages.
|
||||
|
||||
## Отказ telemetry backend
|
||||
|
||||
Readiness API не зависит от Collector/хранилищ. Сначала проверить бизнес-smoke. Collector: queue_size/capacity, send_failed и sent counters; Docker RAM против mem_limit. Retry ограничен 60 s, очереди ограничены; потеря диагностических данных при заполнении допустима, потеря сообщений — нет. Восстановить backend и проверить новый request trace/log и метрики. Не удалять volumes для восстановления.
|
||||
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"rabbit_version": "4.1.8",
|
||||
"vhosts": [
|
||||
{"name": "messenger", "description": "lab6 attachment pipeline", "default_queue_type": "quorum"}
|
||||
],
|
||||
"exchanges": [
|
||||
{"name": "attachments", "vhost": "messenger", "type": "direct", "durable": true, "auto_delete": false, "internal": false, "arguments": {}},
|
||||
{"name": "attachments.dlx", "vhost": "messenger", "type": "fanout", "durable": true, "auto_delete": false, "internal": false, "arguments": {}}
|
||||
],
|
||||
"queues": [
|
||||
{"name": "attachments.process", "vhost": "messenger", "durable": true, "auto_delete": false, "arguments": {"x-queue-type": "quorum"}},
|
||||
{"name": "attachments.process.dlq", "vhost": "messenger", "durable": true, "auto_delete": false, "arguments": {"x-queue-type": "quorum"}}
|
||||
],
|
||||
"bindings": [
|
||||
{"source": "attachments", "vhost": "messenger", "destination": "attachments.process", "destination_type": "queue", "routing_key": "attachment.process.v1", "arguments": {}},
|
||||
{"source": "attachments.dlx", "vhost": "messenger", "destination": "attachments.process.dlq", "destination_type": "queue", "routing_key": "", "arguments": {}}
|
||||
],
|
||||
"policies": [
|
||||
{
|
||||
"vhost": "messenger",
|
||||
"name": "attachments-process",
|
||||
"pattern": "^attachments\\.process$",
|
||||
"apply-to": "queues",
|
||||
"priority": 10,
|
||||
"definition": {
|
||||
"dead-letter-exchange": "attachments.dlx",
|
||||
"dead-letter-strategy": "at-least-once",
|
||||
"overflow": "reject-publish",
|
||||
"delivery-limit": -1
|
||||
}
|
||||
},
|
||||
{
|
||||
"vhost": "messenger",
|
||||
"name": "attachments-dlq",
|
||||
"pattern": "^attachments\\.process\\.dlq$",
|
||||
"apply-to": "queues",
|
||||
"priority": 10,
|
||||
"definition": {
|
||||
"max-length": 100000,
|
||||
"overflow": "reject-publish"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
[rabbitmq_management,rabbitmq_prometheus].
|
||||
@@ -0,0 +1,23 @@
|
||||
listeners.tcp.1 = 127.0.0.1:5672
|
||||
management.tcp.ip = 127.0.0.1
|
||||
management.tcp.port = 15672
|
||||
prometheus.tcp.ip = 127.0.0.1
|
||||
prometheus.tcp.port = 15692
|
||||
|
||||
loopback_users.guest = true
|
||||
log.console = true
|
||||
log.console.level = info
|
||||
log.file = false
|
||||
|
||||
definitions.import_backend = local_filesystem
|
||||
definitions.local.path = /etc/rabbitmq/definitions.d
|
||||
|
||||
vm_memory_high_watermark.absolute = 256MiB
|
||||
disk_free_limit.absolute = 256MB
|
||||
raft.wal_max_size_bytes = 64000000
|
||||
|
||||
consumer_timeout = 300000
|
||||
heartbeat = 30
|
||||
|
||||
deprecated_features.permit.transient_nonexcl_queues = false
|
||||
deprecated_features.permit.global_qos = false
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "MessengerApiObjects",
|
||||
"Effect": "Allow",
|
||||
"Action": ["s3:GetObject", "s3:PutObject", "s3:DeleteObject"],
|
||||
"Resource": ["arn:aws:s3:::messenger-attachments/*"]
|
||||
}
|
||||
]
|
||||
}
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
secret() { tr -d '\r\n' < "/run/secrets/$1"; }
|
||||
endpoint="${S3_ENDPOINT:-http://s3:9000}"
|
||||
RC_HOST_root="${endpoint%%://*}://$(secret s3_root_user):$(secret s3_root_password)@${endpoint#*://}"
|
||||
RC_HOST_api="${endpoint%%://*}://$(secret s3_access_key_id):$(secret s3_secret_access_key)@${endpoint#*://}"
|
||||
RC_HOST_reconciler="${endpoint%%://*}://$(secret s3_reconciler_access_key_id):$(secret s3_reconciler_secret_access_key)@${endpoint#*://}"
|
||||
export RC_HOST_root RC_HOST_api RC_HOST_reconciler
|
||||
rc alias set anon "$endpoint" --anonymous >/dev/null
|
||||
case "${1:-}" in
|
||||
sh|wget) exec "$@" ;;
|
||||
esac
|
||||
exec rc "$@"
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
secret() { tr -d '\r\n' < "/run/secrets/$1"; }
|
||||
bucket="${S3_BUCKET:-messenger-attachments}"
|
||||
endpoint="${S3_ENDPOINT:-http://s3:9000}"
|
||||
policy="${S3_API_POLICY:-messenger-api}"
|
||||
reconciler="${S3_RECONCILER_POLICY:-messenger-reconciler}"
|
||||
RC_HOST_root="${endpoint%%://*}://$(secret s3_root_user):$(secret s3_root_password)@${endpoint#*://}"
|
||||
export RC_HOST_root
|
||||
grant() {
|
||||
sed "s/messenger-attachments/$bucket/g" "/s3/$2" > "/tmp/$2"
|
||||
rc admin policy create root "$1" "/tmp/$2" >/dev/null
|
||||
rc admin user add root "$(secret "$3")" "$(secret "$4")" >/dev/null
|
||||
rc admin policy attach root "$1" --user "$(secret "$3")" >/dev/null
|
||||
rc admin user info root "$(secret "$3")" --json | grep -q "\"$1\""
|
||||
}
|
||||
rc ready root --timeout 10 >/dev/null
|
||||
rc bucket create --ignore-existing "root/$bucket" >/dev/null
|
||||
rc bucket anonymous set private "root/$bucket" >/dev/null
|
||||
grant "$policy" api-policy.json s3_access_key_id s3_secret_access_key
|
||||
grant "$reconciler" reconciler-policy.json s3_reconciler_access_key_id s3_reconciler_secret_access_key
|
||||
grant messenger-worker worker-policy.json s3_worker_access_key_id s3_worker_secret_access_key
|
||||
grant messenger-relay relay-policy.json s3_relay_access_key_id s3_relay_secret_access_key
|
||||
rc bucket lifecycle rule import "root/$bucket" /s3/lifecycle.json >/dev/null
|
||||
rc bucket anonymous get "root/$bucket" --json | grep -q '"permission": *"private"'
|
||||
echo "s3-init: bucket=$bucket anonymous=private policies=$policy,$reconciler lifecycle=abort-incomplete-uploads"
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"rules": [
|
||||
{
|
||||
"id": "abort-incomplete-uploads",
|
||||
"status": "Enabled",
|
||||
"prefix": "",
|
||||
"abortIncompleteMultipartUploadDays": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "MessengerReconcilerObjects",
|
||||
"Effect": "Allow",
|
||||
"Action": ["s3:GetObject", "s3:DeleteObject"],
|
||||
"Resource": ["arn:aws:s3:::messenger-attachments/*"]
|
||||
},
|
||||
{
|
||||
"Sid": "MessengerReconcilerListing",
|
||||
"Effect": "Allow",
|
||||
"Action": ["s3:ListBucket"],
|
||||
"Resource": ["arn:aws:s3:::messenger-attachments"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"s3:DeleteObject"
|
||||
],
|
||||
"Resource": [
|
||||
"arn:aws:s3:::messenger-attachments/staging/*"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "MessengerWorkerRead",
|
||||
"Effect": "Allow",
|
||||
"Action": ["s3:GetObject"],
|
||||
"Resource": [
|
||||
"arn:aws:s3:::messenger-attachments/staging/*",
|
||||
"arn:aws:s3:::messenger-attachments/originals/*",
|
||||
"arn:aws:s3:::messenger-attachments/variants/*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Sid": "MessengerWorkerWrite",
|
||||
"Effect": "Allow",
|
||||
"Action": ["s3:PutObject", "s3:AbortMultipartUpload", "s3:ListMultipartUploadParts"],
|
||||
"Resource": [
|
||||
"arn:aws:s3:::messenger-attachments/originals/*",
|
||||
"arn:aws:s3:::messenger-attachments/variants/*"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
global
|
||||
maxconn 512
|
||||
ssl-default-bind-options ssl-min-ver TLSv1.2
|
||||
ssl-default-server-options ssl-min-ver TLSv1.2
|
||||
defaults
|
||||
mode tcp
|
||||
timeout connect 3s
|
||||
timeout client 60s
|
||||
timeout server 60s
|
||||
resolvers docker
|
||||
nameserver dns 127.0.0.11:53
|
||||
hold valid 2s
|
||||
listen api
|
||||
bind :8443 ssl crt /run/pki/tls.pem ca-file /run/pki/ca.crt crl-file /run/pki/ca.crl verify required
|
||||
acl allowed ssl_c_s_dn(CN) -m str lb operator
|
||||
tcp-request content reject unless allowed
|
||||
server local 127.0.0.1:8080
|
||||
listen out_s3
|
||||
bind 127.0.0.1:19000
|
||||
server remote s3:9443 ssl verify required ca-file /run/pki/ca.crt crt /run/pki/tls.pem verifyhost s3 sni str(s3) resolvers docker init-addr libc,none
|
||||
listen out_broker
|
||||
bind 127.0.0.1:5672
|
||||
server remote broker:5671 ssl verify required ca-file /run/pki/ca.crt crt /run/pki/tls.pem verifyhost broker sni str(broker) resolvers docker init-addr libc,none
|
||||
listen out_collector
|
||||
bind 127.0.0.1:4318
|
||||
server remote otel-collector:44318 ssl verify required ca-file /run/pki/ca.crt crt /run/pki/tls.pem verifyhost otel-collector sni str(otel-collector) resolvers docker init-addr libc,none
|
||||
listen out_valkey
|
||||
bind 127.0.0.1:6379
|
||||
server remote valkey:6380 ssl verify required ca-file /run/pki/ca.crt crt /run/pki/tls.pem verifyhost valkey sni str(valkey) resolvers docker init-addr libc,none
|
||||
@@ -0,0 +1,22 @@
|
||||
global
|
||||
maxconn 512
|
||||
ssl-default-bind-options ssl-min-ver TLSv1.2
|
||||
ssl-default-server-options ssl-min-ver TLSv1.2
|
||||
defaults
|
||||
mode tcp
|
||||
timeout connect 3s
|
||||
timeout client 60s
|
||||
timeout server 60s
|
||||
resolvers docker
|
||||
nameserver dns 127.0.0.11:53
|
||||
hold valid 2s
|
||||
listen broker5671
|
||||
bind :5671 ssl crt /run/pki/tls.pem ca-file /run/pki/ca.crt crl-file /run/pki/ca.crl verify required
|
||||
acl allowed ssl_c_s_dn(CN) -m str api relay worker operator
|
||||
tcp-request content reject unless allowed
|
||||
server local 127.0.0.1:5672
|
||||
listen broker15671
|
||||
bind :15671 ssl crt /run/pki/tls.pem ca-file /run/pki/ca.crt crl-file /run/pki/ca.crl verify required
|
||||
acl allowed ssl_c_s_dn(CN) -m str operator
|
||||
tcp-request content reject unless allowed
|
||||
server local 127.0.0.1:15672
|
||||
@@ -0,0 +1,26 @@
|
||||
global
|
||||
maxconn 512
|
||||
ssl-default-bind-options ssl-min-ver TLSv1.2
|
||||
ssl-default-server-options ssl-min-ver TLSv1.2
|
||||
defaults
|
||||
mode tcp
|
||||
timeout connect 3s
|
||||
timeout client 60s
|
||||
timeout server 60s
|
||||
resolvers docker
|
||||
nameserver dns 127.0.0.11:53
|
||||
hold valid 2s
|
||||
listen grafana9443
|
||||
bind :9443 ssl crt /run/pki/tls.pem ca-file /run/pki/ca.crt crl-file /run/pki/ca.crl verify required
|
||||
acl allowed ssl_c_s_dn(CN) -m str operator prometheus
|
||||
tcp-request content reject unless allowed
|
||||
server local 127.0.0.1:3000
|
||||
listen out_prometheus
|
||||
bind 127.0.0.1:19090
|
||||
server remote prometheus:9443 ssl verify required ca-file /run/pki/ca.crt crt /run/pki/tls.pem verifyhost prometheus sni str(prometheus) resolvers docker init-addr libc,none
|
||||
listen out_loki
|
||||
bind 127.0.0.1:13100
|
||||
server remote loki:9443 ssl verify required ca-file /run/pki/ca.crt crt /run/pki/tls.pem verifyhost loki sni str(loki) resolvers docker init-addr libc,none
|
||||
listen out_tempo
|
||||
bind 127.0.0.1:13200
|
||||
server remote tempo:9443 ssl verify required ca-file /run/pki/ca.crt crt /run/pki/tls.pem verifyhost tempo sni str(tempo) resolvers docker init-addr libc,none
|
||||
@@ -0,0 +1,21 @@
|
||||
global
|
||||
maxconn 512
|
||||
ssl-default-bind-options ssl-min-ver TLSv1.2
|
||||
ssl-default-server-options ssl-min-ver TLSv1.2
|
||||
defaults
|
||||
mode tcp
|
||||
timeout connect 3s
|
||||
timeout client 60s
|
||||
timeout server 60s
|
||||
resolvers docker
|
||||
nameserver dns 127.0.0.11:53
|
||||
hold valid 2s
|
||||
listen loki9443
|
||||
bind :9443 ssl crt /run/pki/tls.pem ca-file /run/pki/ca.crt crl-file /run/pki/ca.crl verify required
|
||||
acl allowed ssl_c_s_dn(CN) -m str otel-collector grafana prometheus operator
|
||||
tcp-request content reject unless allowed
|
||||
mode http
|
||||
http-request deny deny_status 403 if { ssl_c_s_dn(CN) -m str otel-collector } !{ path_beg /otlp/ }
|
||||
http-request deny deny_status 403 if { ssl_c_s_dn(CN) -m str grafana prometheus } !METH_GET !METH_POST
|
||||
http-request deny deny_status 403 if { ssl_c_s_dn(CN) -m str grafana } { path_beg /otlp /loki/api/v1/push /loki/api/v1/delete }
|
||||
server local 127.0.0.1:3100
|
||||
@@ -0,0 +1,22 @@
|
||||
global
|
||||
maxconn 512
|
||||
ssl-default-bind-options ssl-min-ver TLSv1.2
|
||||
ssl-default-server-options ssl-min-ver TLSv1.2
|
||||
defaults
|
||||
mode tcp
|
||||
timeout connect 3s
|
||||
timeout client 60s
|
||||
timeout server 60s
|
||||
resolvers docker
|
||||
nameserver dns 127.0.0.11:53
|
||||
hold valid 2s
|
||||
listen otel_collector44318
|
||||
bind :44318 ssl crt /run/pki/tls.pem ca-file /run/pki/ca.crt crl-file /run/pki/ca.crl verify required
|
||||
acl allowed ssl_c_s_dn(CN) -m str api relay worker operator
|
||||
tcp-request content reject unless allowed
|
||||
server local 127.0.0.1:4318
|
||||
listen otel_collector48888
|
||||
bind :48888 ssl crt /run/pki/tls.pem ca-file /run/pki/ca.crt crl-file /run/pki/ca.crl verify required
|
||||
acl allowed ssl_c_s_dn(CN) -m str prometheus operator
|
||||
tcp-request content reject unless allowed
|
||||
server local 127.0.0.1:8888
|
||||
@@ -0,0 +1,3 @@
|
||||
local all all trust
|
||||
hostssl messenger all all scram-sha-256
|
||||
hostnossl all all all reject
|
||||
@@ -0,0 +1,21 @@
|
||||
global
|
||||
maxconn 512
|
||||
ssl-default-bind-options ssl-min-ver TLSv1.2
|
||||
ssl-default-server-options ssl-min-ver TLSv1.2
|
||||
defaults
|
||||
mode tcp
|
||||
timeout connect 3s
|
||||
timeout client 60s
|
||||
timeout server 60s
|
||||
resolvers docker
|
||||
nameserver dns 127.0.0.11:53
|
||||
hold valid 2s
|
||||
listen prometheus9443
|
||||
bind :9443 ssl crt /run/pki/tls.pem ca-file /run/pki/ca.crt crl-file /run/pki/ca.crl verify required
|
||||
acl allowed ssl_c_s_dn(CN) -m str otel-collector grafana operator
|
||||
tcp-request content reject unless allowed
|
||||
mode http
|
||||
http-request deny deny_status 403 if { ssl_c_s_dn(CN) -m str otel-collector } !{ path_beg /api/v1/otlp/ }
|
||||
http-request deny deny_status 403 if { ssl_c_s_dn(CN) -m str grafana prometheus } !METH_GET !METH_POST
|
||||
http-request deny deny_status 403 if { ssl_c_s_dn(CN) -m str grafana } { path_beg /api/v1/admin /api/v1/otlp /-/ }
|
||||
server local 127.0.0.1:9090
|
||||
@@ -0,0 +1,21 @@
|
||||
global
|
||||
maxconn 512
|
||||
ssl-default-bind-options ssl-min-ver TLSv1.2
|
||||
ssl-default-server-options ssl-min-ver TLSv1.2
|
||||
defaults
|
||||
mode tcp
|
||||
timeout connect 3s
|
||||
timeout client 60s
|
||||
timeout server 60s
|
||||
resolvers docker
|
||||
nameserver dns 127.0.0.11:53
|
||||
hold valid 2s
|
||||
listen out_s3
|
||||
bind 127.0.0.1:19000
|
||||
server remote s3:9443 ssl verify required ca-file /run/pki/ca.crt crt /run/pki/tls.pem verifyhost s3 sni str(s3) resolvers docker init-addr libc,none
|
||||
listen out_broker
|
||||
bind 127.0.0.1:5672
|
||||
server remote broker:5671 ssl verify required ca-file /run/pki/ca.crt crt /run/pki/tls.pem verifyhost broker sni str(broker) resolvers docker init-addr libc,none
|
||||
listen out_collector
|
||||
bind 127.0.0.1:4318
|
||||
server remote otel-collector:44318 ssl verify required ca-file /run/pki/ca.crt crt /run/pki/tls.pem verifyhost otel-collector sni str(otel-collector) resolvers docker init-addr libc,none
|
||||
@@ -0,0 +1,21 @@
|
||||
global
|
||||
maxconn 512
|
||||
ssl-default-bind-options ssl-min-ver TLSv1.2
|
||||
ssl-default-server-options ssl-min-ver TLSv1.2
|
||||
defaults
|
||||
mode tcp
|
||||
timeout connect 3s
|
||||
timeout client 60s
|
||||
timeout server 60s
|
||||
resolvers docker
|
||||
nameserver dns 127.0.0.11:53
|
||||
hold valid 2s
|
||||
listen out_s3
|
||||
bind 127.0.0.1:19000
|
||||
server remote s3:9443 ssl verify required ca-file /run/pki/ca.crt crt /run/pki/tls.pem verifyhost s3 sni str(s3) resolvers docker init-addr libc,none
|
||||
listen out_broker
|
||||
bind 127.0.0.1:5672
|
||||
server remote broker:5671 ssl verify required ca-file /run/pki/ca.crt crt /run/pki/tls.pem verifyhost broker sni str(broker) resolvers docker init-addr libc,none
|
||||
listen out_collector
|
||||
bind 127.0.0.1:4318
|
||||
server remote otel-collector:44318 ssl verify required ca-file /run/pki/ca.crt crt /run/pki/tls.pem verifyhost otel-collector sni str(otel-collector) resolvers docker init-addr libc,none
|
||||
@@ -0,0 +1,17 @@
|
||||
global
|
||||
maxconn 512
|
||||
ssl-default-bind-options ssl-min-ver TLSv1.2
|
||||
ssl-default-server-options ssl-min-ver TLSv1.2
|
||||
defaults
|
||||
mode tcp
|
||||
timeout connect 3s
|
||||
timeout client 60s
|
||||
timeout server 60s
|
||||
resolvers docker
|
||||
nameserver dns 127.0.0.11:53
|
||||
hold valid 2s
|
||||
listen s39443
|
||||
bind :9443 ssl crt /run/pki/tls.pem ca-file /run/pki/ca.crt crl-file /run/pki/ca.crl verify required
|
||||
acl allowed ssl_c_s_dn(CN) -m str api worker relay reconciler operator
|
||||
tcp-request content reject unless allowed
|
||||
server local 127.0.0.1:9000
|
||||
@@ -0,0 +1,22 @@
|
||||
global
|
||||
maxconn 512
|
||||
ssl-default-bind-options ssl-min-ver TLSv1.2
|
||||
ssl-default-server-options ssl-min-ver TLSv1.2
|
||||
defaults
|
||||
mode tcp
|
||||
timeout connect 3s
|
||||
timeout client 60s
|
||||
timeout server 60s
|
||||
resolvers docker
|
||||
nameserver dns 127.0.0.11:53
|
||||
hold valid 2s
|
||||
listen tempo9443
|
||||
bind :9443 ssl crt /run/pki/tls.pem ca-file /run/pki/ca.crt crl-file /run/pki/ca.crl verify required
|
||||
acl allowed ssl_c_s_dn(CN) -m str grafana prometheus operator
|
||||
tcp-request content reject unless allowed
|
||||
server local 127.0.0.1:3200
|
||||
listen tempo44318
|
||||
bind :44318 ssl crt /run/pki/tls.pem ca-file /run/pki/ca.crt crl-file /run/pki/ca.crl verify required
|
||||
acl allowed ssl_c_s_dn(CN) -m str otel-collector operator
|
||||
tcp-request content reject unless allowed
|
||||
server local 127.0.0.1:4318
|
||||
@@ -0,0 +1,17 @@
|
||||
global
|
||||
maxconn 512
|
||||
ssl-default-bind-options ssl-min-ver TLSv1.2
|
||||
ssl-default-server-options ssl-min-ver TLSv1.2
|
||||
defaults
|
||||
mode tcp
|
||||
timeout connect 3s
|
||||
timeout client 60s
|
||||
timeout server 60s
|
||||
resolvers docker
|
||||
nameserver dns 127.0.0.11:53
|
||||
hold valid 2s
|
||||
listen valkey6380
|
||||
bind :6380 ssl crt /run/pki/tls.pem ca-file /run/pki/ca.crt crl-file /run/pki/ca.crl verify required
|
||||
acl allowed ssl_c_s_dn(CN) -m str api operator
|
||||
tcp-request content reject unless allowed
|
||||
server local 127.0.0.1:6379
|
||||
@@ -0,0 +1,21 @@
|
||||
global
|
||||
maxconn 512
|
||||
ssl-default-bind-options ssl-min-ver TLSv1.2
|
||||
ssl-default-server-options ssl-min-ver TLSv1.2
|
||||
defaults
|
||||
mode tcp
|
||||
timeout connect 3s
|
||||
timeout client 60s
|
||||
timeout server 60s
|
||||
resolvers docker
|
||||
nameserver dns 127.0.0.11:53
|
||||
hold valid 2s
|
||||
listen out_s3
|
||||
bind 127.0.0.1:19000
|
||||
server remote s3:9443 ssl verify required ca-file /run/pki/ca.crt crt /run/pki/tls.pem verifyhost s3 sni str(s3) resolvers docker init-addr libc,none
|
||||
listen out_broker
|
||||
bind 127.0.0.1:5672
|
||||
server remote broker:5671 ssl verify required ca-file /run/pki/ca.crt crt /run/pki/tls.pem verifyhost broker sni str(broker) resolvers docker init-addr libc,none
|
||||
listen out_collector
|
||||
bind 127.0.0.1:4318
|
||||
server remote otel-collector:44318 ssl verify required ca-file /run/pki/ca.crt crt /run/pki/tls.pem verifyhost otel-collector sni str(otel-collector) resolvers docker init-addr libc,none
|
||||
@@ -0,0 +1,49 @@
|
||||
stream_over_http_enabled: true
|
||||
|
||||
server:
|
||||
http_listen_address: 127.0.0.1
|
||||
http_listen_port: 3200
|
||||
grpc_listen_address: 127.0.0.1
|
||||
grpc_listen_port: 9095
|
||||
log_level: warn
|
||||
|
||||
distributor:
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
http:
|
||||
endpoint: 127.0.0.1:4318
|
||||
|
||||
ingester:
|
||||
max_block_duration: 5m
|
||||
trace_idle_period: 10s
|
||||
|
||||
compactor:
|
||||
compaction:
|
||||
block_retention: 168h
|
||||
|
||||
query_frontend:
|
||||
search:
|
||||
duration_slo: 5s
|
||||
trace_by_id:
|
||||
duration_slo: 5s
|
||||
|
||||
storage:
|
||||
trace:
|
||||
backend: local
|
||||
wal:
|
||||
path: /var/tempo/wal
|
||||
local:
|
||||
path: /var/tempo/blocks
|
||||
|
||||
overrides:
|
||||
defaults:
|
||||
ingestion:
|
||||
rate_limit_bytes: 15000000
|
||||
burst_size_bytes: 20000000
|
||||
max_traces_per_user: 50000
|
||||
global:
|
||||
max_bytes_per_trace: 5000000
|
||||
|
||||
usage_report:
|
||||
reporting_enabled: false
|
||||
Reference in New Issue
Block a user