feat: реализовать ЛР7 — TLS, mTLS, OpenBao и hardening
Skeleton contracts / contracts (pull_request) Blocked by required conditions
Skeleton contracts / contracts (pull_request) Blocked by required conditions
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
# Persistent SeaweedFS filer metadata for the single-node lab stack.
|
||||
[leveldb2]
|
||||
enabled = true
|
||||
dir = "/data/filerldb2"
|
||||
@@ -0,0 +1,13 @@
|
||||
ui = false
|
||||
disable_mlock = true
|
||||
storage "file" {
|
||||
path = "/openbao/file"
|
||||
}
|
||||
listener "tcp" {
|
||||
address = "0.0.0.0:8200"
|
||||
tls_disable = 0
|
||||
tls_cert_file = "/run/pki/openbao.crt"
|
||||
tls_key_file = "/run/pki/openbao.key"
|
||||
tls_min_version = "tls12"
|
||||
}
|
||||
api_addr = "https://openbao:8200"
|
||||
@@ -0,0 +1,4 @@
|
||||
# Short-lived tokens can only retrieve the credential bundle for api.
|
||||
path "kv/data/api" {
|
||||
capabilities = ["read"]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
# Short-lived tokens can only retrieve the credential bundle for dispatcher.
|
||||
path "kv/data/dispatcher" {
|
||||
capabilities = ["read"]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
# Short-lived tokens can only retrieve the credential bundle for worker.
|
||||
path "kv/data/worker" {
|
||||
capabilities = ["read"]
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 0.0.0.0:4317
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
processors:
|
||||
memory_limiter:
|
||||
check_interval: 1s
|
||||
limit_mib: 180
|
||||
spike_limit_mib: 40
|
||||
batch:
|
||||
timeout: 1s
|
||||
send_batch_size: 128
|
||||
send_batch_max_size: 256
|
||||
exporters:
|
||||
prometheus:
|
||||
endpoint: 0.0.0.0:8889
|
||||
metric_expiration: 15s
|
||||
add_metric_suffixes: true
|
||||
resource_to_telemetry_conversion:
|
||||
enabled: true
|
||||
otlp/tempo:
|
||||
endpoint: metrics-gw:4317
|
||||
tls:
|
||||
ca_file: /run/pki/ca.crt
|
||||
cert_file: /run/pki/client.crt
|
||||
key_file: /run/pki/client.key
|
||||
timeout: 3s
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 1
|
||||
queue_size: 64
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 3s
|
||||
max_elapsed_time: 10s
|
||||
otlphttp/loki:
|
||||
endpoint: https://metrics-gw:3102/otlp
|
||||
tls:
|
||||
ca_file: /run/pki/ca.crt
|
||||
cert_file: /run/pki/client.crt
|
||||
key_file: /run/pki/client.key
|
||||
timeout: 3s
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 1
|
||||
queue_size: 64
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 3s
|
||||
max_elapsed_time: 10s
|
||||
service:
|
||||
telemetry:
|
||||
metrics:
|
||||
readers:
|
||||
- pull:
|
||||
exporter:
|
||||
prometheus:
|
||||
host: 0.0.0.0
|
||||
port: 8888
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, batch]
|
||||
exporters: [prometheus]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, batch]
|
||||
exporters: [otlphttp/loki]
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, batch]
|
||||
exporters: [otlp/tempo]
|
||||
@@ -0,0 +1,805 @@
|
||||
{
|
||||
"uid": "lab6-messenger",
|
||||
"title": "Lab6 | Messenger observability",
|
||||
"schemaVersion": 39,
|
||||
"version": 1,
|
||||
"editable": false,
|
||||
"timezone": "browser",
|
||||
"refresh": "5s",
|
||||
"time": {
|
||||
"from": "now-15m",
|
||||
"to": "now"
|
||||
},
|
||||
"tags": [
|
||||
"lab6",
|
||||
"otel"
|
||||
],
|
||||
"panels": [
|
||||
{
|
||||
"id": 1,
|
||||
"type": "timeseries",
|
||||
"title": "Business API throughput",
|
||||
"description": "Excludes health, counts completed responses.",
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "reqps"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum(rate(lab_http_requests_total{route=~\"/api/.*\"}[30s]))",
|
||||
"legendFormat": "all",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "sum(rate(lab_http_requests_total{route=~\"/api/.*\",status_class=\"5xx\"}[30s])) or vector(0)",
|
||||
"legendFormat": "5xx",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"type": "timeseries",
|
||||
"title": "Business API error ratio (5xx)",
|
||||
"description": "5xx / all business HTTP responses; threshold 5%.",
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 0,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "(sum(rate(lab_http_requests_total{route=~\"/api/.*\",status_class=\"5xx\"}[30s])) or vector(0)) / clamp_min(sum(rate(lab_http_requests_total{route=~\"/api/.*\"}[30s])),0.001)",
|
||||
"legendFormat": "5xx / all",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"type": "timeseries",
|
||||
"title": "API latency p50/p95/p99",
|
||||
"description": "Aggregated histogram buckets across API replicas; seconds, time to response headers.",
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 8,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "histogram_quantile(0.5, sum(rate(lab_http_duration_seconds_bucket{route=~\"/api/.*\"}[30s])) by (le))",
|
||||
"legendFormat": "p50",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "histogram_quantile(0.95, sum(rate(lab_http_duration_seconds_bucket{route=~\"/api/.*\"}[30s])) by (le))",
|
||||
"legendFormat": "p95",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
},
|
||||
{
|
||||
"refId": "C",
|
||||
"expr": "histogram_quantile(0.99, sum(rate(lab_http_duration_seconds_bucket{route=~\"/api/.*\"}[30s])) by (le))",
|
||||
"legendFormat": "p99",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"type": "timeseries",
|
||||
"title": "Jobs per second by outcome",
|
||||
"description": "Attempt outcomes: ready, retry, failed, stale, requeue; not exactly-once audit counts.",
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 8,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "ops"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum by(outcome)(rate(lab_jobs_total[30s]))",
|
||||
"legendFormat": "{{outcome}}",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"type": "timeseries",
|
||||
"title": "Worker processing duration",
|
||||
"description": "",
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 16,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "histogram_quantile(0.5, sum(rate(lab_job_duration_seconds_bucket[30s])) by (le))",
|
||||
"legendFormat": "p50",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "histogram_quantile(0.95, sum(rate(lab_job_duration_seconds_bucket[30s])) by (le))",
|
||||
"legendFormat": "p95",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
},
|
||||
{
|
||||
"refId": "C",
|
||||
"expr": "histogram_quantile(0.99, sum(rate(lab_job_duration_seconds_bucket[30s])) by (le))",
|
||||
"legendFormat": "p99",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"type": "timeseries",
|
||||
"title": "Time to ready",
|
||||
"description": "Acceptance to durable ready (includes queue, retry and processing).",
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 16,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "histogram_quantile(0.5, sum(rate(lab_ready_duration_seconds_bucket[30s])) by (le))",
|
||||
"legendFormat": "p50",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "histogram_quantile(0.95, sum(rate(lab_ready_duration_seconds_bucket[30s])) by (le))",
|
||||
"legendFormat": "p95",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
},
|
||||
{
|
||||
"refId": "C",
|
||||
"expr": "histogram_quantile(0.99, sum(rate(lab_ready_duration_seconds_bucket[30s])) by (le))",
|
||||
"legendFormat": "p99",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"type": "timeseries",
|
||||
"title": "Queue depth: durable backlog / RabbitMQ ready",
|
||||
"description": "DB queued includes delayed/unpublished tasks; RabbitMQ ready counts published messages waiting for delivery; neither includes busy jobs.",
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 24,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "max(lab_queue_depth)",
|
||||
"legendFormat": "DB queued",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "max(lab_broker_ready)",
|
||||
"legendFormat": "broker ready",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"type": "timeseries",
|
||||
"title": "Oldest queued job age",
|
||||
"description": "",
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 24,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "max(lab_queue_oldest_age_seconds)",
|
||||
"legendFormat": "age",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"type": "timeseries",
|
||||
"title": "Database pool",
|
||||
"description": "",
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 32,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "lab_db_pool_used",
|
||||
"legendFormat": "used {{service_instance_id}}",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "lab_db_pool_waiting",
|
||||
"legendFormat": "waiting {{service_instance_id}}",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
},
|
||||
{
|
||||
"refId": "C",
|
||||
"expr": "lab_db_pool_capacity",
|
||||
"legendFormat": "capacity {{service_instance_id}}",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"type": "timeseries",
|
||||
"title": "Worker saturation",
|
||||
"description": "",
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 32,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum(lab_worker_busy) / clamp_min(sum(lab_worker_capacity),1)",
|
||||
"legendFormat": "busy / capacity",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"type": "timeseries",
|
||||
"title": "Container memory (or tree RSS fallback)",
|
||||
"description": "",
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 40,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "bytes"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "lab_container_memory_bytes",
|
||||
"legendFormat": "{{service_name}} / {{service_instance_id}}",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"type": "timeseries",
|
||||
"title": "Container CPU",
|
||||
"description": "CPU cores: 1.0 = one logical core.",
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 40,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "lab_container_cpu_cores",
|
||||
"legendFormat": "{{service_name}} / {{service_instance_id}}",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"type": "timeseries",
|
||||
"title": "Collector exporter queue",
|
||||
"description": "",
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 48,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "otelcol_exporter_queue_size",
|
||||
"legendFormat": "{{exporter}} queue",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "otelcol_exporter_queue_capacity",
|
||||
"legendFormat": "{{exporter}} capacity",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"type": "timeseries",
|
||||
"title": "Collector failed exports",
|
||||
"description": "",
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 48,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "ops"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "rate(otelcol_exporter_send_failed_spans[30s]) or rate(otelcol_exporter_send_failed_spans_total[30s])",
|
||||
"legendFormat": "spans {{exporter}}",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "rate(otelcol_exporter_send_failed_log_records[30s]) or rate(otelcol_exporter_send_failed_log_records_total[30s])",
|
||||
"legendFormat": "logs {{exporter}}",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"type": "timeseries",
|
||||
"title": "Alert state",
|
||||
"description": "",
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 56,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "ALERTS{alertname=~\"Lab.*\"}",
|
||||
"legendFormat": "{{alertname}} / {{alertstate}}",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 16,
|
||||
"type": "timeseries",
|
||||
"title": "SLI: successful availability (5 min)",
|
||||
"description": "1 \u2212 5xx/all business responses over 5 min; objective >= 99%. No data if no traffic.",
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 56,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "1 - ((sum(increase(lab_http_requests_total{route=~\"/api/.*\",status_class=\"5xx\"}[5m])) or vector(0)) / sum(increase(lab_http_requests_total{route=~\"/api/.*\"}[5m])))",
|
||||
"legendFormat": "actual SLI",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "vector(0.99)",
|
||||
"legendFormat": "SLO target 99%",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"editorMode": "code"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
apiVersion: 1
|
||||
providers:
|
||||
- name: Lab6
|
||||
orgId: 1
|
||||
folder: MTUCI
|
||||
type: file
|
||||
disableDeletion: true
|
||||
allowUiUpdates: false
|
||||
updateIntervalSeconds: 10
|
||||
options:
|
||||
path: /var/lib/grafana/dashboards
|
||||
@@ -0,0 +1,36 @@
|
||||
apiVersion: 1
|
||||
datasources:
|
||||
- name: Prometheus
|
||||
type: prometheus
|
||||
uid: prometheus
|
||||
access: proxy
|
||||
url: https://metrics-gw:9091
|
||||
isDefault: true
|
||||
editable: false
|
||||
- name: Loki
|
||||
type: loki
|
||||
uid: loki
|
||||
access: proxy
|
||||
url: https://metrics-gw:3101
|
||||
jsonData:
|
||||
derivedFields:
|
||||
- name: TraceID
|
||||
matcherType: label
|
||||
matcherRegex: trace_id
|
||||
datasourceUid: tempo
|
||||
url: '$${__value.raw}'
|
||||
- name: Tempo
|
||||
type: tempo
|
||||
uid: tempo
|
||||
access: proxy
|
||||
url: https://metrics-gw:3201
|
||||
jsonData:
|
||||
tracesToLogsV2:
|
||||
datasourceUid: loki
|
||||
spanStartTimeShift: '-2s'
|
||||
spanEndTimeShift: '2s'
|
||||
filterByTraceID: true
|
||||
filterBySpanID: false
|
||||
tags:
|
||||
- key: service.name
|
||||
value: service_name
|
||||
@@ -0,0 +1,32 @@
|
||||
auth_enabled: false
|
||||
server:
|
||||
http_listen_port: 3100
|
||||
common:
|
||||
instance_addr: 127.0.0.1
|
||||
path_prefix: /loki
|
||||
storage:
|
||||
filesystem:
|
||||
chunks_directory: /loki/chunks
|
||||
rules_directory: /loki/rules
|
||||
replication_factor: 1
|
||||
ring:
|
||||
kvstore:
|
||||
store: inmemory
|
||||
schema_config:
|
||||
configs:
|
||||
- from: 2024-01-01
|
||||
store: tsdb
|
||||
object_store: filesystem
|
||||
schema: v13
|
||||
index:
|
||||
prefix: index_
|
||||
period: 24h
|
||||
limits_config:
|
||||
allow_structured_metadata: true
|
||||
retention_period: 72h
|
||||
compactor:
|
||||
working_directory: /loki/compactor
|
||||
retention_enabled: true
|
||||
delete_request_store: filesystem
|
||||
analytics:
|
||||
reporting_enabled: false
|
||||
@@ -0,0 +1,19 @@
|
||||
groups:
|
||||
- name: messenger-lab
|
||||
rules:
|
||||
- alert: LabAPIHighErrorRate
|
||||
expr: (sum(rate(lab_http_requests_total{route=~"/api/.*",status_class="5xx"}[30s])) or vector(0)) / clamp_min(sum(rate(lab_http_requests_total{route=~"/api/.*"}[30s])), 0.001) > 0.05
|
||||
for: 9s
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
summary: Business HTTP 5xx rate exceeds 5% over 30 seconds
|
||||
runbook: REPORT.md#инциденты-и-runbook
|
||||
- alert: LabQueueLag
|
||||
expr: max(lab_queue_oldest_age_seconds) > 15 and max(lab_queue_depth) > 0
|
||||
for: 12s
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
summary: Oldest queued job exceeds 15 seconds (sustained 12 seconds)
|
||||
runbook: REPORT.md#инциденты-и-runbook
|
||||
@@ -0,0 +1,18 @@
|
||||
global:
|
||||
scrape_interval: 3s
|
||||
evaluation_interval: 3s
|
||||
rule_files:
|
||||
- /etc/prometheus/alerts.yml
|
||||
scrape_configs:
|
||||
- job_name: lab-otlp
|
||||
scheme: https
|
||||
tls_config:
|
||||
ca_file: /run/pki/ca.crt
|
||||
static_configs:
|
||||
- targets: ['metrics-gw:8889']
|
||||
- job_name: collector-self
|
||||
scheme: https
|
||||
tls_config:
|
||||
ca_file: /run/pki/ca.crt
|
||||
static_configs:
|
||||
- targets: ['metrics-gw:8888']
|
||||
@@ -0,0 +1,22 @@
|
||||
server:
|
||||
http_listen_port: 3200
|
||||
distributor:
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 0.0.0.0:4317
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
storage:
|
||||
trace:
|
||||
backend: local
|
||||
wal:
|
||||
path: /var/tempo/wal
|
||||
local:
|
||||
path: /var/tempo/blocks
|
||||
compactor:
|
||||
compaction:
|
||||
block_retention: 72h
|
||||
usage_report:
|
||||
reporting_enabled: false
|
||||
@@ -0,0 +1,2 @@
|
||||
PostgreSQL native TLS: `ssl=on` and hostnossl reject in pg_hba.conf; verify-full on clients.
|
||||
Certificates are operator generated and copied to a private mounted volume by tls-prepare.
|
||||
@@ -0,0 +1,6 @@
|
||||
# Local only for initialization/administration inside the container.
|
||||
local all all trust
|
||||
hostnossl all all 0.0.0.0/0 reject
|
||||
hostnossl all all ::/0 reject
|
||||
hostssl all all 0.0.0.0/0 scram-sha-256
|
||||
hostssl all all ::/0 scram-sha-256
|
||||
@@ -0,0 +1,15 @@
|
||||
global
|
||||
log stdout format raw local0
|
||||
defaults
|
||||
mode http
|
||||
timeout connect 2s
|
||||
timeout client 60s
|
||||
timeout server 60s
|
||||
frontend from_lb
|
||||
bind :8443 ssl crt /run/pki/api1-tls.pem ca-file /run/pki/ca.crt crl-file /run/pki/ca.crl verify required ssl-min-ver TLSv1.2
|
||||
acl trusted_identity ssl_c_s_dn(cn) -m str lab7-lb
|
||||
acl trusted_san ssl_c_san -m reg (^|,)([[:space:]]*)DNS:lab7-lb($|,)
|
||||
http-request deny deny_status 403 unless trusted_identity trusted_san
|
||||
default_backend local_api
|
||||
backend local_api
|
||||
server app 127.0.0.1:8080 check
|
||||
@@ -0,0 +1,15 @@
|
||||
global
|
||||
log stdout format raw local0
|
||||
defaults
|
||||
mode http
|
||||
timeout connect 2s
|
||||
timeout client 60s
|
||||
timeout server 60s
|
||||
frontend from_lb
|
||||
bind :8443 ssl crt /run/pki/api2-tls.pem ca-file /run/pki/ca.crt crl-file /run/pki/ca.crl verify required ssl-min-ver TLSv1.2
|
||||
acl trusted_identity ssl_c_s_dn(cn) -m str lab7-lb
|
||||
acl trusted_san ssl_c_san -m reg (^|,)([[:space:]]*)DNS:lab7-lb($|,)
|
||||
http-request deny deny_status 403 unless trusted_identity trusted_san
|
||||
default_backend local_api
|
||||
backend local_api
|
||||
server app 127.0.0.1:8080 check
|
||||
@@ -0,0 +1,17 @@
|
||||
global
|
||||
log stdout format raw local0
|
||||
defaults
|
||||
mode tcp
|
||||
timeout connect 3s
|
||||
timeout client 90s
|
||||
timeout server 90s
|
||||
frontend mqtls
|
||||
bind :5671 ssl crt /run/pki/broker-gw.pem ca-file /run/pki/ca.crt crl-file /run/pki/ca.crl verify required ssl-min-ver TLSv1.2
|
||||
acl role_ok ssl_c_s_dn(cn) -m str messenger-worker messenger-dispatcher
|
||||
acl san_worker ssl_c_san -m reg (^|,)([[:space:]]*)DNS:messenger-worker($|,)
|
||||
acl san_dispatch ssl_c_san -m reg (^|,)([[:space:]]*)DNS:messenger-dispatcher($|,)
|
||||
tcp-request content reject unless role_ok
|
||||
tcp-request content reject unless san_worker or san_dispatch
|
||||
default_backend rabbitmq
|
||||
backend rabbitmq
|
||||
server b broker:5672 check
|
||||
@@ -0,0 +1,13 @@
|
||||
global
|
||||
log stdout format raw local0
|
||||
defaults
|
||||
mode http
|
||||
timeout connect 3s
|
||||
timeout client 60s
|
||||
timeout server 60s
|
||||
frontend public_tls
|
||||
bind :3443 ssl crt /run/pki/grafana-gw.pem ssl-min-ver TLSv1.2
|
||||
http-request set-header X-Forwarded-Proto https
|
||||
default_backend grafana_internal
|
||||
backend grafana_internal
|
||||
server grafana grafana:3000 check
|
||||
@@ -0,0 +1,24 @@
|
||||
global
|
||||
log stdout format raw local0
|
||||
maxconn 1000
|
||||
defaults
|
||||
mode http
|
||||
timeout connect 3s
|
||||
timeout client 60s
|
||||
timeout server 60s
|
||||
timeout http-request 7s
|
||||
option httplog
|
||||
resolvers docker
|
||||
nameserver dns 127.0.0.11:53
|
||||
hold valid 1s
|
||||
frontend https_public
|
||||
bind :8443 ssl crt /run/pki/ingress.pem ssl-min-ver TLSv1.2
|
||||
http-request set-header X-Forwarded-Proto https
|
||||
default_backend api_cluster
|
||||
backend api_cluster
|
||||
balance roundrobin
|
||||
option httpchk GET /health/ready
|
||||
http-check expect status 200
|
||||
default-server inter 2s fall 2 rise 1 slowstart 2s
|
||||
server api1 api1:8443 ssl ca-file /run/pki/ca.crt crt /run/pki/lb-client.pem verify required verifyhost api1-tls check resolvers docker init-addr none
|
||||
server api2 api2:8443 ssl ca-file /run/pki/ca.crt crt /run/pki/lb-client.pem verify required verifyhost api2-tls check resolvers docker init-addr none
|
||||
@@ -0,0 +1,59 @@
|
||||
global
|
||||
log stdout format raw local0
|
||||
defaults
|
||||
timeout connect 3s
|
||||
timeout client 60s
|
||||
timeout server 60s
|
||||
frontend prometheus_tls
|
||||
mode http
|
||||
bind :9091 ssl crt /run/pki/metrics-gw.pem ssl-min-ver TLSv1.2
|
||||
default_backend prometheus_plain
|
||||
backend prometheus_plain
|
||||
mode http
|
||||
server prometheus prometheus:9090
|
||||
frontend loki_tls
|
||||
mode http
|
||||
bind :3101 ssl crt /run/pki/metrics-gw.pem ssl-min-ver TLSv1.2
|
||||
default_backend loki_plain
|
||||
backend loki_plain
|
||||
mode http
|
||||
server loki loki:3100
|
||||
frontend tempo_tls
|
||||
mode http
|
||||
bind :3201 ssl crt /run/pki/metrics-gw.pem ssl-min-ver TLSv1.2
|
||||
default_backend tempo_plain
|
||||
backend tempo_plain
|
||||
mode http
|
||||
server tempo tempo:3200
|
||||
frontend tempo_grpc_tls
|
||||
mode tcp
|
||||
bind :4317 ssl crt /run/pki/metrics-gw.pem ca-file /run/pki/ca.crt crl-file /run/pki/ca.crl verify required alpn h2 ssl-min-ver TLSv1.2
|
||||
acl collector_role ssl_c_s_dn(cn) -m str messenger-collector
|
||||
acl collector_san ssl_c_san -m reg (^|,)([[:space:]]*)DNS:messenger-collector($|,)
|
||||
tcp-request content reject unless collector_role collector_san
|
||||
default_backend tempo_grpc_plain
|
||||
backend tempo_grpc_plain
|
||||
mode tcp
|
||||
server tempo tempo:4317
|
||||
frontend collector_scrape_tls
|
||||
mode http
|
||||
bind :8889 ssl crt /run/pki/metrics-gw.pem ssl-min-ver TLSv1.2
|
||||
default_backend collector_scrape_plain
|
||||
backend collector_scrape_plain
|
||||
mode http
|
||||
server collector otel-collector:8889
|
||||
frontend collector_self_tls
|
||||
mode http
|
||||
bind :8888 ssl crt /run/pki/metrics-gw.pem ssl-min-ver TLSv1.2
|
||||
default_backend collector_self_plain
|
||||
backend collector_self_plain
|
||||
mode http
|
||||
server collector otel-collector:8888
|
||||
|
||||
frontend loki_ingest_mtls
|
||||
mode http
|
||||
bind :3102 ssl crt /run/pki/metrics-gw.pem ca-file /run/pki/ca.crt crl-file /run/pki/ca.crl verify required ssl-min-ver TLSv1.2
|
||||
acl collector_role ssl_c_s_dn(cn) -m str messenger-collector
|
||||
acl collector_san ssl_c_san -m reg (^|,)([[:space:]]*)DNS:messenger-collector($|,)
|
||||
http-request deny deny_status 403 unless collector_role collector_san
|
||||
default_backend loki_plain
|
||||
@@ -0,0 +1,15 @@
|
||||
global
|
||||
log stdout format raw local0
|
||||
defaults
|
||||
mode http
|
||||
timeout connect 3s
|
||||
timeout client 15s
|
||||
timeout server 15s
|
||||
frontend tls_ingest
|
||||
bind :4318 ssl crt /run/pki/otel-gw.pem ca-file /run/pki/ca.crt crl-file /run/pki/ca.crl verify required ssl-min-ver TLSv1.2
|
||||
acl identity_ok ssl_c_s_dn(cn) -m str messenger-api1 messenger-api2 messenger-worker messenger-dispatcher
|
||||
acl san_ok ssl_c_san -m reg (^|,)([[:space:]]*)DNS:messenger-(api1|api2|worker|dispatcher)($|,)
|
||||
http-request deny deny_status 403 unless identity_ok san_ok
|
||||
default_backend otlp_http
|
||||
backend otlp_http
|
||||
server collector otel-collector:4318 check
|
||||
@@ -0,0 +1,12 @@
|
||||
global
|
||||
log stdout format raw local0
|
||||
defaults
|
||||
mode tcp
|
||||
timeout connect 2s
|
||||
timeout client 90s
|
||||
timeout server 90s
|
||||
frontend redis_tls
|
||||
bind :6380 ssl crt /run/pki/redis-gw.pem ssl-min-ver TLSv1.2
|
||||
default_backend plain_redis
|
||||
backend plain_redis
|
||||
server redis redis:6379 check
|
||||
@@ -0,0 +1,12 @@
|
||||
global
|
||||
log stdout format raw local0
|
||||
defaults
|
||||
mode http
|
||||
timeout connect 3s
|
||||
timeout client 60s
|
||||
timeout server 60s
|
||||
frontend s3_https
|
||||
bind :8334 ssl crt /run/pki/s3-gw.pem ssl-min-ver TLSv1.2
|
||||
default_backend seaweed
|
||||
backend seaweed
|
||||
server s3 s3:8333 check
|
||||
Reference in New Issue
Block a user