forked from mtusi2026/mtusi2026lab7
Реализация на 5
This commit is contained in:
@@ -5,3 +5,7 @@
|
||||
В REPORT.md сопоставьте роль → service name → версия/digest → health/readiness → volume → сеть/порт → способ передачи credentials. Приведите bootstrap (schema, bucket, broker topology, а с lab6 provisioning) и безопасное повторение этих команд.
|
||||
|
||||
Приложение строится из исходников. Не используйте заранее существующий образ преподавательского сервера вместо своей реализации. Restart hook перезапускает все соответствующие stores с volumes; failover hook останавливает только заданную API-реплику.
|
||||
|
||||
## Реализация lab7
|
||||
|
||||
Топология находится в корневом `compose.yaml` (JSON является допустимым YAML). Начальная команда — `make up`; полная инструкция и версии — в [REPORT.md](../REPORT.md). TLS boundaries генерируются `infra/generate.py` и хранятся как открытые Envoy configurations. Runtime credentials, private keys и Grafana secure provisioning создаются только в игнорируемом `secrets/`.
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
{
|
||||
"static_resources": {
|
||||
"listeners": [
|
||||
{
|
||||
"name": "loki",
|
||||
"address": {
|
||||
"socket_address": {
|
||||
"address": "0.0.0.0",
|
||||
"port_value": 9443
|
||||
}
|
||||
},
|
||||
"filter_chains": [
|
||||
{
|
||||
"transport_socket": {
|
||||
"name": "envoy.transport_sockets.tls",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext",
|
||||
"require_client_certificate": true,
|
||||
"common_tls_context": {
|
||||
"tls_params": {
|
||||
"tls_minimum_protocol_version": "TLSv1_2"
|
||||
},
|
||||
"tls_certificates": [
|
||||
{
|
||||
"certificate_chain": {
|
||||
"filename": "/run/identity/tls.crt"
|
||||
},
|
||||
"private_key": {
|
||||
"filename": "/run/identity/tls.key"
|
||||
}
|
||||
}
|
||||
],
|
||||
"validation_context": {
|
||||
"trusted_ca": {
|
||||
"filename": "/run/identity/ca.crt"
|
||||
},
|
||||
"crl": {
|
||||
"filename": "/run/identity/ca.crl"
|
||||
},
|
||||
"match_typed_subject_alt_names": [
|
||||
{
|
||||
"san_type": "DNS",
|
||||
"matcher": {
|
||||
"exact": "otel-collector"
|
||||
}
|
||||
},
|
||||
{
|
||||
"san_type": "DNS",
|
||||
"matcher": {
|
||||
"exact": "grafana"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"filters": [
|
||||
{
|
||||
"name": "envoy.filters.network.http_connection_manager",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
|
||||
"stat_prefix": "loki",
|
||||
"codec_type": "AUTO",
|
||||
"route_config": {
|
||||
"name": "routes",
|
||||
"virtual_hosts": [
|
||||
{
|
||||
"name": "local",
|
||||
"domains": [
|
||||
"*"
|
||||
],
|
||||
"routes": [
|
||||
{
|
||||
"match": {
|
||||
"prefix": "/"
|
||||
},
|
||||
"route": {
|
||||
"cluster": "loki",
|
||||
"timeout": "125s"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"http_filters": [
|
||||
{
|
||||
"name": "envoy.filters.http.rbac",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.http.rbac.v3.RBAC",
|
||||
"rules": {
|
||||
"action": "ALLOW",
|
||||
"policies": {
|
||||
"otel-collector": {
|
||||
"principals": [
|
||||
{
|
||||
"authenticated": {
|
||||
"principal_name": {
|
||||
"exact": "otel-collector"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"permissions": [
|
||||
{
|
||||
"and_rules": {
|
||||
"rules": [
|
||||
{
|
||||
"header": {
|
||||
"name": ":method",
|
||||
"string_match": {
|
||||
"safe_regex": {
|
||||
"regex": "^(POST)$"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"url_path": {
|
||||
"path": {
|
||||
"safe_regex": {
|
||||
"regex": "^/otlp/v1/logs$"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"grafana": {
|
||||
"principals": [
|
||||
{
|
||||
"authenticated": {
|
||||
"principal_name": {
|
||||
"exact": "grafana"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"permissions": [
|
||||
{
|
||||
"and_rules": {
|
||||
"rules": [
|
||||
{
|
||||
"header": {
|
||||
"name": ":method",
|
||||
"string_match": {
|
||||
"safe_regex": {
|
||||
"regex": "^(GET)$"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"url_path": {
|
||||
"path": {
|
||||
"safe_regex": {
|
||||
"regex": "^/(loki/api/v1/.*|ready)$"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "envoy.filters.http.router",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.http.router.v3.Router"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"clusters": [
|
||||
{
|
||||
"name": "loki",
|
||||
"connect_timeout": "1s",
|
||||
"type": "STATIC",
|
||||
"load_assignment": {
|
||||
"cluster_name": "loki",
|
||||
"endpoints": [
|
||||
{
|
||||
"lb_endpoints": [
|
||||
{
|
||||
"endpoint": {
|
||||
"address": {
|
||||
"socket_address": {
|
||||
"address": "127.0.0.1",
|
||||
"port_value": 3100
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,365 @@
|
||||
{
|
||||
"static_resources": {
|
||||
"listeners": [
|
||||
{
|
||||
"name": "otlp",
|
||||
"address": {
|
||||
"socket_address": {
|
||||
"address": "0.0.0.0",
|
||||
"port_value": 9443
|
||||
}
|
||||
},
|
||||
"filter_chains": [
|
||||
{
|
||||
"transport_socket": {
|
||||
"name": "envoy.transport_sockets.tls",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext",
|
||||
"require_client_certificate": true,
|
||||
"common_tls_context": {
|
||||
"tls_params": {
|
||||
"tls_minimum_protocol_version": "TLSv1_2"
|
||||
},
|
||||
"tls_certificates": [
|
||||
{
|
||||
"certificate_chain": {
|
||||
"filename": "/run/identity/tls.crt"
|
||||
},
|
||||
"private_key": {
|
||||
"filename": "/run/identity/tls.key"
|
||||
}
|
||||
}
|
||||
],
|
||||
"validation_context": {
|
||||
"trusted_ca": {
|
||||
"filename": "/run/identity/ca.crt"
|
||||
},
|
||||
"crl": {
|
||||
"filename": "/run/identity/ca.crl"
|
||||
},
|
||||
"match_typed_subject_alt_names": [
|
||||
{
|
||||
"san_type": "DNS",
|
||||
"matcher": {
|
||||
"exact": "api"
|
||||
}
|
||||
},
|
||||
{
|
||||
"san_type": "DNS",
|
||||
"matcher": {
|
||||
"exact": "worker"
|
||||
}
|
||||
},
|
||||
{
|
||||
"san_type": "DNS",
|
||||
"matcher": {
|
||||
"exact": "dispatcher"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"filters": [
|
||||
{
|
||||
"name": "envoy.filters.network.http_connection_manager",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
|
||||
"stat_prefix": "otlp",
|
||||
"codec_type": "AUTO",
|
||||
"route_config": {
|
||||
"name": "routes",
|
||||
"virtual_hosts": [
|
||||
{
|
||||
"name": "local",
|
||||
"domains": [
|
||||
"*"
|
||||
],
|
||||
"routes": [
|
||||
{
|
||||
"match": {
|
||||
"prefix": "/"
|
||||
},
|
||||
"route": {
|
||||
"cluster": "otlp",
|
||||
"timeout": "125s"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"http_filters": [
|
||||
{
|
||||
"name": "envoy.filters.http.router",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.http.router.v3.Router"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "metrics",
|
||||
"address": {
|
||||
"socket_address": {
|
||||
"address": "0.0.0.0",
|
||||
"port_value": 9444
|
||||
}
|
||||
},
|
||||
"filter_chains": [
|
||||
{
|
||||
"transport_socket": {
|
||||
"name": "envoy.transport_sockets.tls",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext",
|
||||
"require_client_certificate": true,
|
||||
"common_tls_context": {
|
||||
"tls_params": {
|
||||
"tls_minimum_protocol_version": "TLSv1_2"
|
||||
},
|
||||
"tls_certificates": [
|
||||
{
|
||||
"certificate_chain": {
|
||||
"filename": "/run/identity/tls.crt"
|
||||
},
|
||||
"private_key": {
|
||||
"filename": "/run/identity/tls.key"
|
||||
}
|
||||
}
|
||||
],
|
||||
"validation_context": {
|
||||
"trusted_ca": {
|
||||
"filename": "/run/identity/ca.crt"
|
||||
},
|
||||
"crl": {
|
||||
"filename": "/run/identity/ca.crl"
|
||||
},
|
||||
"match_typed_subject_alt_names": [
|
||||
{
|
||||
"san_type": "DNS",
|
||||
"matcher": {
|
||||
"exact": "prometheus"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"filters": [
|
||||
{
|
||||
"name": "envoy.filters.network.http_connection_manager",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
|
||||
"stat_prefix": "metrics",
|
||||
"codec_type": "AUTO",
|
||||
"route_config": {
|
||||
"name": "routes",
|
||||
"virtual_hosts": [
|
||||
{
|
||||
"name": "local",
|
||||
"domains": [
|
||||
"*"
|
||||
],
|
||||
"routes": [
|
||||
{
|
||||
"match": {
|
||||
"prefix": "/"
|
||||
},
|
||||
"route": {
|
||||
"cluster": "metrics",
|
||||
"timeout": "125s"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"http_filters": [
|
||||
{
|
||||
"name": "envoy.filters.http.router",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.http.router.v3.Router"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "collector-metrics",
|
||||
"address": {
|
||||
"socket_address": {
|
||||
"address": "0.0.0.0",
|
||||
"port_value": 9445
|
||||
}
|
||||
},
|
||||
"filter_chains": [
|
||||
{
|
||||
"transport_socket": {
|
||||
"name": "envoy.transport_sockets.tls",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext",
|
||||
"require_client_certificate": true,
|
||||
"common_tls_context": {
|
||||
"tls_params": {
|
||||
"tls_minimum_protocol_version": "TLSv1_2"
|
||||
},
|
||||
"tls_certificates": [
|
||||
{
|
||||
"certificate_chain": {
|
||||
"filename": "/run/identity/tls.crt"
|
||||
},
|
||||
"private_key": {
|
||||
"filename": "/run/identity/tls.key"
|
||||
}
|
||||
}
|
||||
],
|
||||
"validation_context": {
|
||||
"trusted_ca": {
|
||||
"filename": "/run/identity/ca.crt"
|
||||
},
|
||||
"crl": {
|
||||
"filename": "/run/identity/ca.crl"
|
||||
},
|
||||
"match_typed_subject_alt_names": [
|
||||
{
|
||||
"san_type": "DNS",
|
||||
"matcher": {
|
||||
"exact": "prometheus"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"filters": [
|
||||
{
|
||||
"name": "envoy.filters.network.http_connection_manager",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
|
||||
"stat_prefix": "collector-metrics",
|
||||
"codec_type": "AUTO",
|
||||
"route_config": {
|
||||
"name": "routes",
|
||||
"virtual_hosts": [
|
||||
{
|
||||
"name": "local",
|
||||
"domains": [
|
||||
"*"
|
||||
],
|
||||
"routes": [
|
||||
{
|
||||
"match": {
|
||||
"prefix": "/"
|
||||
},
|
||||
"route": {
|
||||
"cluster": "collector-metrics",
|
||||
"timeout": "125s"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"http_filters": [
|
||||
{
|
||||
"name": "envoy.filters.http.router",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.http.router.v3.Router"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"clusters": [
|
||||
{
|
||||
"name": "otlp",
|
||||
"connect_timeout": "1s",
|
||||
"type": "STATIC",
|
||||
"load_assignment": {
|
||||
"cluster_name": "otlp",
|
||||
"endpoints": [
|
||||
{
|
||||
"lb_endpoints": [
|
||||
{
|
||||
"endpoint": {
|
||||
"address": {
|
||||
"socket_address": {
|
||||
"address": "127.0.0.1",
|
||||
"port_value": 4318
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "metrics",
|
||||
"connect_timeout": "1s",
|
||||
"type": "STATIC",
|
||||
"load_assignment": {
|
||||
"cluster_name": "metrics",
|
||||
"endpoints": [
|
||||
{
|
||||
"lb_endpoints": [
|
||||
{
|
||||
"endpoint": {
|
||||
"address": {
|
||||
"socket_address": {
|
||||
"address": "127.0.0.1",
|
||||
"port_value": 8889
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "collector-metrics",
|
||||
"connect_timeout": "1s",
|
||||
"type": "STATIC",
|
||||
"load_assignment": {
|
||||
"cluster_name": "collector-metrics",
|
||||
"endpoints": [
|
||||
{
|
||||
"lb_endpoints": [
|
||||
{
|
||||
"endpoint": {
|
||||
"address": {
|
||||
"socket_address": {
|
||||
"address": "127.0.0.1",
|
||||
"port_value": 8888
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
{
|
||||
"static_resources": {
|
||||
"listeners": [
|
||||
{
|
||||
"name": "query",
|
||||
"address": {
|
||||
"socket_address": {
|
||||
"address": "0.0.0.0",
|
||||
"port_value": 9443
|
||||
}
|
||||
},
|
||||
"filter_chains": [
|
||||
{
|
||||
"transport_socket": {
|
||||
"name": "envoy.transport_sockets.tls",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext",
|
||||
"require_client_certificate": true,
|
||||
"common_tls_context": {
|
||||
"tls_params": {
|
||||
"tls_minimum_protocol_version": "TLSv1_2"
|
||||
},
|
||||
"tls_certificates": [
|
||||
{
|
||||
"certificate_chain": {
|
||||
"filename": "/run/identity/tls.crt"
|
||||
},
|
||||
"private_key": {
|
||||
"filename": "/run/identity/tls.key"
|
||||
}
|
||||
}
|
||||
],
|
||||
"validation_context": {
|
||||
"trusted_ca": {
|
||||
"filename": "/run/identity/ca.crt"
|
||||
},
|
||||
"crl": {
|
||||
"filename": "/run/identity/ca.crl"
|
||||
},
|
||||
"match_typed_subject_alt_names": [
|
||||
{
|
||||
"san_type": "DNS",
|
||||
"matcher": {
|
||||
"exact": "grafana"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"filters": [
|
||||
{
|
||||
"name": "envoy.filters.network.http_connection_manager",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
|
||||
"stat_prefix": "query",
|
||||
"codec_type": "AUTO",
|
||||
"route_config": {
|
||||
"name": "routes",
|
||||
"virtual_hosts": [
|
||||
{
|
||||
"name": "local",
|
||||
"domains": [
|
||||
"*"
|
||||
],
|
||||
"routes": [
|
||||
{
|
||||
"match": {
|
||||
"prefix": "/"
|
||||
},
|
||||
"route": {
|
||||
"cluster": "query",
|
||||
"timeout": "125s"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"http_filters": [
|
||||
{
|
||||
"name": "envoy.filters.http.rbac",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.http.rbac.v3.RBAC",
|
||||
"rules": {
|
||||
"action": "ALLOW",
|
||||
"policies": {
|
||||
"grafana": {
|
||||
"principals": [
|
||||
{
|
||||
"authenticated": {
|
||||
"principal_name": {
|
||||
"exact": "grafana"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"permissions": [
|
||||
{
|
||||
"and_rules": {
|
||||
"rules": [
|
||||
{
|
||||
"header": {
|
||||
"name": ":method",
|
||||
"string_match": {
|
||||
"safe_regex": {
|
||||
"regex": "^(GET|POST)$"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"url_path": {
|
||||
"path": {
|
||||
"safe_regex": {
|
||||
"regex": "^/(api/v1/(query|query_range|labels|label/[^/]+/values|series|metadata|status/buildinfo)|-/ready).*"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "envoy.filters.http.router",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.http.router.v3.Router"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"clusters": [
|
||||
{
|
||||
"name": "query",
|
||||
"connect_timeout": "1s",
|
||||
"type": "STATIC",
|
||||
"load_assignment": {
|
||||
"cluster_name": "query",
|
||||
"endpoints": [
|
||||
{
|
||||
"lb_endpoints": [
|
||||
{
|
||||
"endpoint": {
|
||||
"address": {
|
||||
"socket_address": {
|
||||
"address": "127.0.0.1",
|
||||
"port_value": 9090
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
{
|
||||
"static_resources": {
|
||||
"listeners": [
|
||||
{
|
||||
"name": "s3",
|
||||
"address": {
|
||||
"socket_address": {
|
||||
"address": "0.0.0.0",
|
||||
"port_value": 9443
|
||||
}
|
||||
},
|
||||
"filter_chains": [
|
||||
{
|
||||
"transport_socket": {
|
||||
"name": "envoy.transport_sockets.tls",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext",
|
||||
"require_client_certificate": true,
|
||||
"common_tls_context": {
|
||||
"tls_params": {
|
||||
"tls_minimum_protocol_version": "TLSv1_2"
|
||||
},
|
||||
"tls_certificates": [
|
||||
{
|
||||
"certificate_chain": {
|
||||
"filename": "/run/identity/tls.crt"
|
||||
},
|
||||
"private_key": {
|
||||
"filename": "/run/identity/tls.key"
|
||||
}
|
||||
}
|
||||
],
|
||||
"validation_context": {
|
||||
"trusted_ca": {
|
||||
"filename": "/run/identity/ca.crt"
|
||||
},
|
||||
"crl": {
|
||||
"filename": "/run/identity/ca.crl"
|
||||
},
|
||||
"match_typed_subject_alt_names": [
|
||||
{
|
||||
"san_type": "DNS",
|
||||
"matcher": {
|
||||
"exact": "api"
|
||||
}
|
||||
},
|
||||
{
|
||||
"san_type": "DNS",
|
||||
"matcher": {
|
||||
"exact": "worker"
|
||||
}
|
||||
},
|
||||
{
|
||||
"san_type": "DNS",
|
||||
"matcher": {
|
||||
"exact": "operator-client"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"filters": [
|
||||
{
|
||||
"name": "envoy.filters.network.http_connection_manager",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
|
||||
"stat_prefix": "s3",
|
||||
"codec_type": "AUTO",
|
||||
"route_config": {
|
||||
"name": "routes",
|
||||
"virtual_hosts": [
|
||||
{
|
||||
"name": "local",
|
||||
"domains": [
|
||||
"*"
|
||||
],
|
||||
"routes": [
|
||||
{
|
||||
"match": {
|
||||
"prefix": "/"
|
||||
},
|
||||
"route": {
|
||||
"cluster": "s3",
|
||||
"timeout": "125s"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"http_filters": [
|
||||
{
|
||||
"name": "envoy.filters.http.router",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.http.router.v3.Router"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"clusters": [
|
||||
{
|
||||
"name": "s3",
|
||||
"connect_timeout": "1s",
|
||||
"type": "STATIC",
|
||||
"load_assignment": {
|
||||
"cluster_name": "s3",
|
||||
"endpoints": [
|
||||
{
|
||||
"lb_endpoints": [
|
||||
{
|
||||
"endpoint": {
|
||||
"address": {
|
||||
"socket_address": {
|
||||
"address": "127.0.0.1",
|
||||
"port_value": 9000
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
{
|
||||
"static_resources": {
|
||||
"listeners": [
|
||||
{
|
||||
"name": "query",
|
||||
"address": {
|
||||
"socket_address": {
|
||||
"address": "0.0.0.0",
|
||||
"port_value": 9443
|
||||
}
|
||||
},
|
||||
"filter_chains": [
|
||||
{
|
||||
"transport_socket": {
|
||||
"name": "envoy.transport_sockets.tls",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext",
|
||||
"require_client_certificate": true,
|
||||
"common_tls_context": {
|
||||
"tls_params": {
|
||||
"tls_minimum_protocol_version": "TLSv1_2"
|
||||
},
|
||||
"tls_certificates": [
|
||||
{
|
||||
"certificate_chain": {
|
||||
"filename": "/run/identity/tls.crt"
|
||||
},
|
||||
"private_key": {
|
||||
"filename": "/run/identity/tls.key"
|
||||
}
|
||||
}
|
||||
],
|
||||
"validation_context": {
|
||||
"trusted_ca": {
|
||||
"filename": "/run/identity/ca.crt"
|
||||
},
|
||||
"crl": {
|
||||
"filename": "/run/identity/ca.crl"
|
||||
},
|
||||
"match_typed_subject_alt_names": [
|
||||
{
|
||||
"san_type": "DNS",
|
||||
"matcher": {
|
||||
"exact": "grafana"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"filters": [
|
||||
{
|
||||
"name": "envoy.filters.network.http_connection_manager",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
|
||||
"stat_prefix": "query",
|
||||
"codec_type": "AUTO",
|
||||
"route_config": {
|
||||
"name": "routes",
|
||||
"virtual_hosts": [
|
||||
{
|
||||
"name": "local",
|
||||
"domains": [
|
||||
"*"
|
||||
],
|
||||
"routes": [
|
||||
{
|
||||
"match": {
|
||||
"prefix": "/"
|
||||
},
|
||||
"route": {
|
||||
"cluster": "query",
|
||||
"timeout": "125s"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"http_filters": [
|
||||
{
|
||||
"name": "envoy.filters.http.router",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.http.router.v3.Router"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ingest",
|
||||
"address": {
|
||||
"socket_address": {
|
||||
"address": "0.0.0.0",
|
||||
"port_value": 9444
|
||||
}
|
||||
},
|
||||
"filter_chains": [
|
||||
{
|
||||
"transport_socket": {
|
||||
"name": "envoy.transport_sockets.tls",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext",
|
||||
"require_client_certificate": true,
|
||||
"common_tls_context": {
|
||||
"tls_params": {
|
||||
"tls_minimum_protocol_version": "TLSv1_2"
|
||||
},
|
||||
"tls_certificates": [
|
||||
{
|
||||
"certificate_chain": {
|
||||
"filename": "/run/identity/tls.crt"
|
||||
},
|
||||
"private_key": {
|
||||
"filename": "/run/identity/tls.key"
|
||||
}
|
||||
}
|
||||
],
|
||||
"validation_context": {
|
||||
"trusted_ca": {
|
||||
"filename": "/run/identity/ca.crt"
|
||||
},
|
||||
"crl": {
|
||||
"filename": "/run/identity/ca.crl"
|
||||
},
|
||||
"match_typed_subject_alt_names": [
|
||||
{
|
||||
"san_type": "DNS",
|
||||
"matcher": {
|
||||
"exact": "otel-collector"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"filters": [
|
||||
{
|
||||
"name": "envoy.filters.network.http_connection_manager",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
|
||||
"stat_prefix": "ingest",
|
||||
"codec_type": "AUTO",
|
||||
"route_config": {
|
||||
"name": "routes",
|
||||
"virtual_hosts": [
|
||||
{
|
||||
"name": "local",
|
||||
"domains": [
|
||||
"*"
|
||||
],
|
||||
"routes": [
|
||||
{
|
||||
"match": {
|
||||
"prefix": "/"
|
||||
},
|
||||
"route": {
|
||||
"cluster": "ingest",
|
||||
"timeout": "125s"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"http_filters": [
|
||||
{
|
||||
"name": "envoy.filters.http.router",
|
||||
"typed_config": {
|
||||
"@type": "type.googleapis.com/envoy.extensions.filters.http.router.v3.Router"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"clusters": [
|
||||
{
|
||||
"name": "query",
|
||||
"connect_timeout": "1s",
|
||||
"type": "STATIC",
|
||||
"load_assignment": {
|
||||
"cluster_name": "query",
|
||||
"endpoints": [
|
||||
{
|
||||
"lb_endpoints": [
|
||||
{
|
||||
"endpoint": {
|
||||
"address": {
|
||||
"socket_address": {
|
||||
"address": "127.0.0.1",
|
||||
"port_value": 3200
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ingest",
|
||||
"connect_timeout": "1s",
|
||||
"type": "STATIC",
|
||||
"load_assignment": {
|
||||
"cluster_name": "ingest",
|
||||
"endpoints": [
|
||||
{
|
||||
"lb_endpoints": [
|
||||
{
|
||||
"endpoint": {
|
||||
"address": {
|
||||
"socket_address": {
|
||||
"address": "127.0.0.1",
|
||||
"port_value": 4318
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate deterministic public Envoy TLS boundaries (JSON is valid YAML)."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
ROOT=Path(__file__).resolve().parent
|
||||
|
||||
def generate(name,listeners):
|
||||
result={'static_resources':{'listeners':[],'clusters':[]}}
|
||||
for label,port,upstream,identities in listeners:
|
||||
tls={'@type':'type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext','require_client_certificate':True,'common_tls_context':{'tls_params':{'tls_minimum_protocol_version':'TLSv1_2'},'tls_certificates':[{'certificate_chain':{'filename':'/run/identity/tls.crt'},'private_key':{'filename':'/run/identity/tls.key'}}], 'validation_context':{'trusted_ca':{'filename':'/run/identity/ca.crt'},'crl':{'filename':'/run/identity/ca.crl'},'match_typed_subject_alt_names':[{'san_type':'DNS','matcher':{'exact':i}} for i in identities]}}}
|
||||
route={'name':'routes','virtual_hosts':[{'name':'local','domains':['*'],'routes':[{'match':{'prefix':'/'},'route':{'cluster':label,'timeout':'125s'}}]}]}
|
||||
filters=[]
|
||||
if name in ['loki','prometheus']:
|
||||
rules={}
|
||||
for identity in identities:
|
||||
methods=['GET','POST'] if identity=='grafana' and name=='prometheus' else ['GET'] if identity=='grafana' else ['POST']
|
||||
pattern='^/(api/v1/(query|query_range|labels|label/[^/]+/values|series|metadata|status/buildinfo)|-/ready).*' if name=='prometheus' else '^/(loki/api/v1/.*|ready)$' if identity=='grafana' else '^/otlp/v1/logs$'
|
||||
rules[identity]={'principals':[{'authenticated':{'principal_name':{'exact':identity}}}],'permissions':[{'and_rules':{'rules':[{'header':{'name':':method','string_match':{'safe_regex':{'regex':'^('+'|'.join(methods)+')$'}}}},{'url_path':{'path':{'safe_regex':{'regex':pattern}}}}]}}]}
|
||||
filters.append({'name':'envoy.filters.http.rbac','typed_config':{'@type':'type.googleapis.com/envoy.extensions.filters.http.rbac.v3.RBAC','rules':{'action':'ALLOW','policies':rules}}})
|
||||
filters.append({'name':'envoy.filters.http.router','typed_config':{'@type':'type.googleapis.com/envoy.extensions.filters.http.router.v3.Router'}})
|
||||
hcm={'@type':'type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager','stat_prefix':label,'codec_type':'AUTO','route_config':route,'http_filters':filters}
|
||||
result['static_resources']['listeners'].append({'name':label,'address':{'socket_address':{'address':'0.0.0.0','port_value':port}},'filter_chains':[{'transport_socket':{'name':'envoy.transport_sockets.tls','typed_config':tls},'filters':[{'name':'envoy.filters.network.http_connection_manager','typed_config':hcm}]}]})
|
||||
result['static_resources']['clusters'].append({'name':label,'connect_timeout':'1s','type':'STATIC','load_assignment':{'cluster_name':label,'endpoints':[{'lb_endpoints':[{'endpoint':{'address':{'socket_address':{'address':'127.0.0.1','port_value':upstream}}}}]}]}})
|
||||
(ROOT/'envoy'/f'{name}.json').write_text(json.dumps(result,indent=2)+'\n')
|
||||
for name,ls in {
|
||||
's3':[('s3',9443,9000,['api','worker','operator-client'])],
|
||||
'otel-collector':[('otlp',9443,4318,['api','worker','dispatcher']),('metrics',9444,8889,['prometheus']),('collector-metrics',9445,8888,['prometheus'])],
|
||||
'loki':[('loki',9443,3100,['otel-collector','grafana'])],
|
||||
'tempo':[('query',9443,3200,['grafana']),('ingest',9444,4318,['otel-collector'])],
|
||||
'prometheus':[('query',9443,9090,['grafana'])],
|
||||
}.items():generate(name,ls)
|
||||
@@ -0,0 +1,31 @@
|
||||
global
|
||||
maxconn 1024
|
||||
stats socket /tmp/haproxy.sock mode 600 level admin
|
||||
ssl-default-bind-options ssl-min-ver TLSv1.2
|
||||
ssl-default-server-options ssl-min-ver TLSv1.2
|
||||
|
||||
defaults
|
||||
mode http
|
||||
timeout connect 1s
|
||||
timeout client 125s
|
||||
timeout server 125s
|
||||
timeout check 1s
|
||||
retries 0
|
||||
|
||||
resolvers docker
|
||||
nameserver dns 127.0.0.11:53
|
||||
hold valid 1s
|
||||
hold obsolete 1s
|
||||
|
||||
frontend public
|
||||
bind :8443 ssl crt /run/identity/bundle.pem
|
||||
http-request deny deny_status 404 if { path_beg /internal }
|
||||
http-request set-header X-Forwarded-For %[src]
|
||||
default_backend api
|
||||
|
||||
backend api
|
||||
balance roundrobin
|
||||
option httpchk
|
||||
http-check send meth GET uri /health/ready ver HTTP/1.1 hdr Host api
|
||||
http-check expect status 200
|
||||
server-template replica 1-4 api:8080 ssl verify required ca-file /run/identity/ca.crt crt /run/identity/bundle.pem verifyhost api sni str(api) check inter 1s fall 2 rise 1 resolvers docker init-addr none
|
||||
@@ -0,0 +1,13 @@
|
||||
<policymap>
|
||||
<policy domain="delegate" rights="none" pattern="*"/>
|
||||
<policy domain="filter" rights="none" pattern="*"/>
|
||||
<policy domain="coder" rights="none" pattern="*"/>
|
||||
<policy domain="coder" rights="read|write" pattern="{PNG,JPEG,WEBP,NULL}"/>
|
||||
<policy domain="resource" name="memory" value="256MiB"/>
|
||||
<policy domain="resource" name="map" value="0"/>
|
||||
<policy domain="resource" name="disk" value="256MiB"/>
|
||||
<policy domain="resource" name="thread" value="1"/>
|
||||
<policy domain="resource" name="time" value="60"/>
|
||||
<policy domain="resource" name="list-length" value="4"/>
|
||||
<policy domain="path" rights="none" pattern="@*"/>
|
||||
</policymap>
|
||||
@@ -5,3 +5,7 @@
|
||||
Решение должно показать реальную сервисную аутентификацию и получение нужного secret по ограниченной policy; просто работающий контейнер OpenBao не засчитывается. На 3 статический KV secret допустим. На 4 покажите expiry/renewal/rotation и allow/deny. Путь KV v2 data/metadata и ACL должен соответствовать фактическому mount; не копируйте широкое `path "*"` для приложения.
|
||||
|
||||
Документируйте шаги оператора init/unseal и восстановление после restart. Скрипт не должен печатать tokens/shares или хранить их в Git. См. contracts/trust-matrix.md и REPORT.md.
|
||||
|
||||
## Реализованный workflow
|
||||
|
||||
`server.hcl` задаёт persistent file storage, TLS и declarative audit. Отдельные API/worker/dispatcher policies находятся рядом. `scripts/bao.py` делает operator init/unseal и provisioning; начальный root token отзывается после успеха. Приложение использует cert auth, scoped KV и dynamic database credentials. CA key и unseal shares не монтируются сервисам. После restart оператор выполняет `python3 scripts/bao.py unseal`; recovery и отказ sealed проверяются отдельным сценарием. Подробности и ограничения — в [REPORT.md](../../REPORT.md).
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
path "secret/data/api" { capabilities = ["read"] }
|
||||
path "database/creds/api" { capabilities = ["read"] }
|
||||
path "auth/token/renew-self" { capabilities = ["update"] }
|
||||
path "auth/token/revoke-self" { capabilities = ["update"] }
|
||||
path "sys/leases/renew" { capabilities = ["update"] }
|
||||
@@ -0,0 +1,5 @@
|
||||
path "secret/data/dispatcher" { capabilities = ["read"] }
|
||||
path "database/creds/dispatcher" { capabilities = ["read"] }
|
||||
path "auth/token/renew-self" { capabilities = ["update"] }
|
||||
path "auth/token/revoke-self" { capabilities = ["update"] }
|
||||
path "sys/leases/renew" { capabilities = ["update"] }
|
||||
@@ -0,0 +1,14 @@
|
||||
ui = false
|
||||
api_addr = "https://openbao:8200"
|
||||
storage "file" { path = "/openbao/data" }
|
||||
listener "tcp" {
|
||||
address = "0.0.0.0:8200"
|
||||
tls_cert_file = "/run/identity/tls.crt"
|
||||
tls_key_file = "/run/identity/tls.key"
|
||||
tls_client_ca_file = "/run/identity/ca.crt"
|
||||
tls_min_version = "tls12"
|
||||
}
|
||||
|
||||
audit "file" "local" {
|
||||
options { file_path = "/openbao/data/audit.json" }
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
path "secret/data/worker" { capabilities = ["read"] }
|
||||
path "database/creds/worker" { capabilities = ["read"] }
|
||||
path "auth/token/renew-self" { capabilities = ["update"] }
|
||||
path "auth/token/revoke-self" { capabilities = ["update"] }
|
||||
path "sys/leases/renew" { capabilities = ["update"] }
|
||||
@@ -5,3 +5,7 @@
|
||||
Добавьте конфигурации storage, Grafana provisioning/datasources, provisioning/dashboards и импортируемые dashboard JSON. На 4 — alert rules и runbooks. Пустой dashboard или debug exporter, который только печатает данные в stdout, не заменяют хранилища/доказательства из `contracts/observability.md`.
|
||||
|
||||
Не публикуйте OTLP/metrics/административные ports в общую сеть без необходимости. В lab7 реализуйте TLS/mTLS по trust matrix; экспорт Authorization и message bodies запрещён.
|
||||
|
||||
## Реализованный workflow
|
||||
|
||||
Collector принимает OTLP через mTLS Envoy boundary; plaintext receiver доступен только по loopback. Prometheus/Loki/Tempo и Grafana используют проверяемый TLS с разными identities и ingest/query restrictions. Dashboard/alerts — в этом каталоге; secure datasource provisioning создаёт bootstrap вне Git. Проверка реальных сигналов — `scripts/prove-telemetry.py`, диагностика — [RUNBOOK.md](RUNBOOK.md).
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
# Диагностика lab7
|
||||
|
||||
Grafana доступна по HTTPS на localhost:13443. CA — локальный lab7 CA; anonymous выключен. Datasource client identity и trust material генерируются в закрытом secrets-каталоге, исходные dashboard и alert rules находятся в Git.
|
||||
|
||||
Сначала проверить свежесть observation metrics и `up`, затем HTTP 5xx/p95, backlog/oldest age, DB pool и worker busy/capacity. Trace ID связывает upload/publish/consume/S3/DB с логами; request ID связывает HTTP-ошибку. Пропуск telemetry не означает нулевой backlog.
|
||||
|
||||
При остановке worker API продолжает durable acceptance, растут backlog/age и QueueLag; после запуска backlog снижается. При отказе DB возрастают 5xx и DB spans/errors; при исчерпании pool readiness уходит в 503. При отказе Tempo/Loki SDK и Collector используют ограниченные queues/retry; API не делает эти backend критичными для readiness. Grafana также не влияет на readiness.
|
||||
|
||||
Если TLS proxy не отвечает после рестарта backend, пересоздать соответствующий `*-tls` service: он должен войти в новый network namespace родителя. Не открывать backend plaintext listener на bridge. Проверить CA/SAN, срок leaf и актуальность CRL; не использовать insecure mode.
|
||||
|
||||
При sealed OpenBao действующие grants используются до ограниченного deadline; затем процесс завершает операции и restart требует нового cert auth. Оператор выполняет `python3 scripts/bao.py unseal`, проверяет readiness и новый lease. При компрометации worker использовать `scripts/rotate-worker.py`, затем проверить jobs/checksums и старые credentials.
|
||||
|
||||
Пороговые условия и окна alerts перенесены из lab6. CPU/RAM и error ratios интерпретировать в пределах synthetic profile и фактических limits из Compose.
|
||||
@@ -0,0 +1,126 @@
|
||||
{
|
||||
"groups": [
|
||||
{
|
||||
"name": "messenger-slo",
|
||||
"interval": "5s",
|
||||
"rules": [
|
||||
{
|
||||
"record": "messenger:api_error_ratio:1m",
|
||||
"expr": "(sum(rate(messenger_http_requests_total{route=~\"/api/v1/.*\",status_class=\"5xx\"}[1m])) or vector(0)) / sum(rate(messenger_http_requests_total{route=~\"/api/v1/.*\"}[1m]))"
|
||||
},
|
||||
{
|
||||
"record": "messenger:api_error_ratio:2m",
|
||||
"expr": "(sum(rate(messenger_http_requests_total{route=~\"/api/v1/.*\",status_class=\"5xx\"}[2m])) or vector(0)) / sum(rate(messenger_http_requests_total{route=~\"/api/v1/.*\"}[2m]))"
|
||||
},
|
||||
{
|
||||
"record": "messenger:api_error_ratio:5m",
|
||||
"expr": "(sum(rate(messenger_http_requests_total{route=~\"/api/v1/.*\",status_class=\"5xx\"}[5m])) or vector(0)) / sum(rate(messenger_http_requests_total{route=~\"/api/v1/.*\"}[5m]))"
|
||||
},
|
||||
{
|
||||
"record": "messenger:api_error_ratio:10m",
|
||||
"expr": "(sum(rate(messenger_http_requests_total{route=~\"/api/v1/.*\",status_class=\"5xx\"}[10m])) or vector(0)) / sum(rate(messenger_http_requests_total{route=~\"/api/v1/.*\"}[10m]))"
|
||||
},
|
||||
{
|
||||
"alert": "ApiBurnRateFast",
|
||||
"expr": "(messenger:api_error_ratio:1m > 0.06) and (messenger:api_error_ratio:5m > 0.06) and (sum(increase(messenger_http_requests_total{route=~\"/api/v1/.*\"}[1m])) >= 20)",
|
||||
"for": "20s",
|
||||
"labels": {
|
||||
"severity": "warning",
|
||||
"slo": "api"
|
||||
},
|
||||
"annotations": {
|
||||
"summary": "api SLO budget burning above 6x",
|
||||
"runbook": "infra/otel/RUNBOOK.md"
|
||||
}
|
||||
},
|
||||
{
|
||||
"alert": "ApiBurnRateSlow",
|
||||
"expr": "(messenger:api_error_ratio:2m > 0.03) and (messenger:api_error_ratio:10m > 0.03) and (sum(increase(messenger_http_requests_total{route=~\"/api/v1/.*\"}[2m])) >= 20)",
|
||||
"for": "30s",
|
||||
"labels": {
|
||||
"severity": "warning",
|
||||
"slo": "api"
|
||||
},
|
||||
"annotations": {
|
||||
"summary": "api SLO budget burning above 3x",
|
||||
"runbook": "infra/otel/RUNBOOK.md"
|
||||
}
|
||||
},
|
||||
{
|
||||
"record": "messenger:ready_error_ratio:1m",
|
||||
"expr": "sum(rate(messenger_ready_slo_total{outcome=\"bad\"}[1m])) / sum(rate(messenger_ready_slo_total[1m]))"
|
||||
},
|
||||
{
|
||||
"record": "messenger:ready_error_ratio:2m",
|
||||
"expr": "sum(rate(messenger_ready_slo_total{outcome=\"bad\"}[2m])) / sum(rate(messenger_ready_slo_total[2m]))"
|
||||
},
|
||||
{
|
||||
"record": "messenger:ready_error_ratio:5m",
|
||||
"expr": "sum(rate(messenger_ready_slo_total{outcome=\"bad\"}[5m])) / sum(rate(messenger_ready_slo_total[5m]))"
|
||||
},
|
||||
{
|
||||
"record": "messenger:ready_error_ratio:10m",
|
||||
"expr": "sum(rate(messenger_ready_slo_total{outcome=\"bad\"}[10m])) / sum(rate(messenger_ready_slo_total[10m]))"
|
||||
},
|
||||
{
|
||||
"alert": "ReadyBurnRateFast",
|
||||
"expr": "(messenger:ready_error_ratio:1m > 0.06) and (messenger:ready_error_ratio:5m > 0.06) and (sum(increase(messenger_ready_slo_total[1m])) >= 5)",
|
||||
"for": "20s",
|
||||
"labels": {
|
||||
"severity": "warning",
|
||||
"slo": "ready"
|
||||
},
|
||||
"annotations": {
|
||||
"summary": "ready SLO budget burning above 6x",
|
||||
"runbook": "infra/otel/RUNBOOK.md"
|
||||
}
|
||||
},
|
||||
{
|
||||
"alert": "ReadyBurnRateSlow",
|
||||
"expr": "(messenger:ready_error_ratio:2m > 0.03) and (messenger:ready_error_ratio:10m > 0.03) and (sum(increase(messenger_ready_slo_total[2m])) >= 5)",
|
||||
"for": "30s",
|
||||
"labels": {
|
||||
"severity": "warning",
|
||||
"slo": "ready"
|
||||
},
|
||||
"annotations": {
|
||||
"summary": "ready SLO budget burning above 3x",
|
||||
"runbook": "infra/otel/RUNBOOK.md"
|
||||
}
|
||||
},
|
||||
{
|
||||
"alert": "QueueLag",
|
||||
"expr": "max(messenger_queue_oldest_age_seconds) > 30",
|
||||
"for": "20s",
|
||||
"labels": {
|
||||
"severity": "warning"
|
||||
},
|
||||
"annotations": {
|
||||
"summary": "Unfinished attachment age exceeds 30s",
|
||||
"runbook": "infra/otel/RUNBOOK.md"
|
||||
}
|
||||
},
|
||||
{
|
||||
"alert": "ObservationsStale",
|
||||
"expr": "time() - max(messenger_observation_timestamp) > 20 or absent(messenger_observation_timestamp)",
|
||||
"for": "20s",
|
||||
"labels": {
|
||||
"severity": "warning"
|
||||
},
|
||||
"annotations": {
|
||||
"summary": "No fresh dispatcher observations",
|
||||
"runbook": "infra/otel/RUNBOOK.md"
|
||||
}
|
||||
},
|
||||
{
|
||||
"record": "messenger:api_error_ratio:1h",
|
||||
"expr": "(sum(rate(messenger_http_requests_total{route=~\"/api/v1/.*\",status_class=\"5xx\"}[1h])) or vector(0)) / sum(rate(messenger_http_requests_total{route=~\"/api/v1/.*\"}[1h]))"
|
||||
},
|
||||
{
|
||||
"record": "messenger:ready_error_ratio:1h",
|
||||
"expr": "sum(rate(messenger_ready_slo_total{outcome=\"bad\"}[1h])) / sum(rate(messenger_ready_slo_total[1h]))"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
http:
|
||||
endpoint: 127.0.0.1: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: 127.0.0.1:8889
|
||||
resource_to_telemetry_conversion:
|
||||
enabled: true
|
||||
otlphttp/tempo:
|
||||
tls:
|
||||
ca_file: /run/identity/ca.crt
|
||||
cert_file: /run/identity/tls.crt
|
||||
key_file: /run/identity/tls.key
|
||||
endpoint: https://tempo:9444
|
||||
timeout: 2s
|
||||
retry_on_failure:
|
||||
initial_interval: 1s
|
||||
max_interval: 5s
|
||||
max_elapsed_time: 30s
|
||||
sending_queue:
|
||||
queue_size: 32
|
||||
num_consumers: 2
|
||||
otlphttp/loki:
|
||||
tls:
|
||||
ca_file: /run/identity/ca.crt
|
||||
cert_file: /run/identity/tls.crt
|
||||
key_file: /run/identity/tls.key
|
||||
endpoint: https://loki:9443/otlp
|
||||
timeout: 2s
|
||||
retry_on_failure:
|
||||
initial_interval: 1s
|
||||
max_interval: 5s
|
||||
max_elapsed_time: 30s
|
||||
sending_queue:
|
||||
queue_size: 32
|
||||
num_consumers: 2
|
||||
extensions:
|
||||
health_check:
|
||||
endpoint: 127.0.0.1:13133
|
||||
service:
|
||||
telemetry:
|
||||
metrics:
|
||||
readers:
|
||||
- pull:
|
||||
exporter:
|
||||
prometheus:
|
||||
host: 127.0.0.1
|
||||
port: 8888
|
||||
extensions: [health_check]
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, batch]
|
||||
exporters: [prometheus]
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, batch]
|
||||
exporters: [otlphttp/tempo]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, batch]
|
||||
exporters: [otlphttp/loki]
|
||||
@@ -0,0 +1,770 @@
|
||||
{
|
||||
"uid": "messenger-lab6",
|
||||
"title": "Messenger \u2014 lab6",
|
||||
"schemaVersion": 39,
|
||||
"version": 2,
|
||||
"refresh": "5s",
|
||||
"time": {
|
||||
"from": "now-30m",
|
||||
"to": "now"
|
||||
},
|
||||
"panels": [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "HTTP RPS",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum by (route) (rate(messenger_http_requests_total[1m]))",
|
||||
"legendFormat": "{{service_name}} {{route}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "reqps"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "HTTP 5xx ratio",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 0,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "messenger:api_error_ratio:1m",
|
||||
"legendFormat": "{{service_name}} {{route}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"title": "HTTP p50/p95/p99",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 8,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "0.5",
|
||||
"expr": "histogram_quantile(0.5,sum by (le)(rate(messenger_http_duration_seconds_bucket{route=~\"/api/v1/.*\"}[1m])))",
|
||||
"legendFormat": "0.5"
|
||||
},
|
||||
{
|
||||
"refId": "0.95",
|
||||
"expr": "histogram_quantile(0.95,sum by (le)(rate(messenger_http_duration_seconds_bucket{route=~\"/api/v1/.*\"}[1m])))",
|
||||
"legendFormat": "0.95"
|
||||
},
|
||||
{
|
||||
"refId": "0.99",
|
||||
"expr": "histogram_quantile(0.99,sum by (le)(rate(messenger_http_duration_seconds_bucket{route=~\"/api/v1/.*\"}[1m])))",
|
||||
"legendFormat": "0.99"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
},
|
||||
"description": "Business routes only; histogram quantiles across all API replicas. Bucket interpolation is approximate."
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"title": "Job outcomes",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 8,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum by (outcome) (rate(messenger_jobs_total[1m]))",
|
||||
"legendFormat": "{{service_name}} {{route}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "ops"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"title": "Processing p95",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 16,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "histogram_quantile(0.95,sum by(le)(rate(messenger_job_duration_seconds_bucket[1m])))",
|
||||
"legendFormat": "{{service_name}} {{route}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"title": "Time to ready p95",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 16,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "histogram_quantile(0.95,sum by(le)(rate(messenger_job_ready_duration_seconds_bucket[1m])))",
|
||||
"legendFormat": "{{service_name}} {{route}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"title": "RabbitMQ ready messages",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 24,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "messenger_queue_depth",
|
||||
"legendFormat": "{{service_name}} {{route}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"title": "Logical pending jobs / outbox",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 24,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "messenger_jobs_pending",
|
||||
"legendFormat": "jobs"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "messenger_outbox_pending",
|
||||
"legendFormat": "outbox"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"title": "Oldest unfinished job",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 32,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "messenger_queue_oldest_age_seconds",
|
||||
"legendFormat": "{{service_name}} {{route}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"title": "DB connections used/capacity/waiting",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 32,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum by (service_name)(messenger_db_pool_used)",
|
||||
"legendFormat": "used {{service_name}}"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "sum by (service_name)(messenger_db_pool_capacity)",
|
||||
"legendFormat": "capacity {{service_name}}"
|
||||
},
|
||||
{
|
||||
"refId": "C",
|
||||
"expr": "sum by (service_name)(messenger_db_pool_waiting)",
|
||||
"legendFormat": "waiting {{service_name}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"title": "Worker busy/capacity",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 40,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "messenger_worker_busy{service_name=\"messenger-worker\"}",
|
||||
"legendFormat": "busy"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "messenger_worker_capacity{service_name=\"messenger-worker\"}",
|
||||
"legendFormat": "capacity"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"title": "Process memory RSS",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 40,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "messenger_process_memory",
|
||||
"legendFormat": "{{service_name}} {{route}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "bytes"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"title": "CPU by service (% of one core)",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 48,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "100 * sum by(service_name)(rate(messenger_process_cpu[1m]))",
|
||||
"legendFormat": "{{service_name}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percent"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"title": "API burn rate",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 48,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "messenger:api_error_ratio:1m / 0.01",
|
||||
"legendFormat": "{{service_name}} {{route}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"title": "Ready burn rate",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 56,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "messenger:ready_error_ratio:1m / 0.01",
|
||||
"legendFormat": "{{service_name}} {{route}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 16,
|
||||
"title": "Alerts",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 56,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "ALERTS{alertstate=\"firing\"}",
|
||||
"legendFormat": "{{service_name}} {{route}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 17,
|
||||
"title": "Collector export failures",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 64,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "rate(otelcol_exporter_send_failed_spans_total[1m])",
|
||||
"legendFormat": "{{service_name}} {{route}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "ops"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 18,
|
||||
"title": "Observation freshness",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 64,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "time() - messenger_observation_timestamp",
|
||||
"legendFormat": "{{service_name}} {{route}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"options": {
|
||||
"legend": {
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 19,
|
||||
"title": "API SLI \u2014 1 hour",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 72,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "1 - messenger:api_error_ratio:1h"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 20,
|
||||
"title": "Ready SLI \u2014 1 hour",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 72,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "1 - messenger:ready_error_ratio:1h"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 21,
|
||||
"title": "Exporter bounded queue",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 80,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "otelcol_exporter_queue_size",
|
||||
"legendFormat": "size {{exporter}}"
|
||||
},
|
||||
{
|
||||
"refId": "B",
|
||||
"expr": "otelcol_exporter_queue_capacity",
|
||||
"legendFormat": "capacity {{exporter}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 22,
|
||||
"title": "DB lock waiters",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 80,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "messenger_db_locks_waiting"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
apiVersion: 1
|
||||
providers:
|
||||
- name: Messenger
|
||||
folder: Lab6
|
||||
type: file
|
||||
options:
|
||||
path: /var/lib/grafana/dashboards
|
||||
@@ -0,0 +1,40 @@
|
||||
auth_enabled: false
|
||||
server:
|
||||
grpc_listen_address: 127.0.0.1
|
||||
http_listen_address: 127.0.0.1
|
||||
http_listen_port: 3100
|
||||
common:
|
||||
instance_addr: 127.0.0.1
|
||||
path_prefix: /loki
|
||||
replication_factor: 1
|
||||
ring:
|
||||
kvstore:
|
||||
store: inmemory
|
||||
storage:
|
||||
filesystem:
|
||||
chunks_directory: /loki/chunks
|
||||
rules_directory: /loki/rules
|
||||
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: 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
|
||||
@@ -0,0 +1,22 @@
|
||||
global:
|
||||
scrape_interval: 5s
|
||||
evaluation_interval: 5s
|
||||
rule_files:
|
||||
- /etc/prometheus/alerts.yaml
|
||||
scrape_configs:
|
||||
- job_name: messenger
|
||||
scheme: https
|
||||
tls_config: &tls
|
||||
ca_file: /run/identity/ca.crt
|
||||
cert_file: /run/identity/tls.crt
|
||||
key_file: /run/identity/tls.key
|
||||
static_configs:
|
||||
- targets: ['otel-collector:9444']
|
||||
- job_name: collector
|
||||
scheme: https
|
||||
tls_config: *tls
|
||||
static_configs:
|
||||
- targets: ['otel-collector:9445']
|
||||
- job_name: prometheus
|
||||
static_configs:
|
||||
- targets: ['localhost:9090']
|
||||
@@ -0,0 +1,26 @@
|
||||
server:
|
||||
http_listen_address: 127.0.0.1
|
||||
grpc_listen_address: 127.0.0.1
|
||||
http_listen_port: 3200
|
||||
distributor:
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
http:
|
||||
endpoint: 127.0.0.1:4318
|
||||
ingester:
|
||||
lifecycler:
|
||||
address: 127.0.0.1
|
||||
max_block_duration: 5m
|
||||
compactor:
|
||||
compaction:
|
||||
block_retention: 168h
|
||||
storage:
|
||||
trace:
|
||||
backend: local
|
||||
wal:
|
||||
path: /var/tempo/wal
|
||||
local:
|
||||
path: /var/tempo/blocks
|
||||
usage_report:
|
||||
reporting_enabled: false
|
||||
@@ -0,0 +1,10 @@
|
||||
REVOKE CREATE ON SCHEMA public FROM PUBLIC;
|
||||
GRANT USAGE ON SCHEMA public TO api_role,worker_role,dispatcher_role;
|
||||
GRANT SELECT,INSERT,UPDATE ON users,refresh_tokens,chats,chat_members,messages,message_idempotency,message_attachments,attachments,attachment_jobs,job_slo,outbox TO api_role;
|
||||
GRANT SELECT ON attachment_variants TO api_role;
|
||||
GRANT SELECT,UPDATE ON attachments,attachment_jobs,job_slo TO worker_role;
|
||||
GRANT INSERT,SELECT ON attachment_variants,job_audit TO worker_role;
|
||||
GRANT USAGE ON SEQUENCE job_audit_id_seq TO worker_role;
|
||||
GRANT INSERT,SELECT ON outbox TO worker_role;
|
||||
GRANT SELECT,UPDATE ON outbox,job_slo,attachments,attachment_jobs TO dispatcher_role;
|
||||
GRANT SELECT ON attachment_variants TO dispatcher_role;
|
||||
@@ -0,0 +1,5 @@
|
||||
local all all trust
|
||||
hostssl messenger all 0.0.0.0/0 scram-sha-256
|
||||
hostssl messenger all ::/0 scram-sha-256
|
||||
hostnossl all all 0.0.0.0/0 reject
|
||||
hostnossl all all ::/0 reject
|
||||
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"users": [
|
||||
{
|
||||
"name": "worker",
|
||||
"password_hash": "",
|
||||
"tags": []
|
||||
},
|
||||
{
|
||||
"name": "dispatcher",
|
||||
"password_hash": "",
|
||||
"tags": []
|
||||
},
|
||||
{
|
||||
"name": "operator-client",
|
||||
"password_hash": "",
|
||||
"tags": []
|
||||
}
|
||||
],
|
||||
"vhosts": [
|
||||
{
|
||||
"name": "attachments"
|
||||
}
|
||||
],
|
||||
"permissions": [
|
||||
{
|
||||
"user": "worker",
|
||||
"vhost": "attachments",
|
||||
"configure": "^$",
|
||||
"write": "^$",
|
||||
"read": "^attachments\\.v1$"
|
||||
},
|
||||
{
|
||||
"user": "dispatcher",
|
||||
"vhost": "attachments",
|
||||
"configure": "^$",
|
||||
"write": "^(attachments\\.publish|amq\\.default)$",
|
||||
"read": "^attachments\\.v1$"
|
||||
},
|
||||
{
|
||||
"user": "operator-client",
|
||||
"vhost": "attachments",
|
||||
"configure": "^attachments.*",
|
||||
"write": "^(attachments.*|amq\\.default)$",
|
||||
"read": "^attachments.*"
|
||||
}
|
||||
],
|
||||
"queues": [
|
||||
{
|
||||
"name": "attachments.v1",
|
||||
"vhost": "attachments",
|
||||
"durable": true,
|
||||
"auto_delete": false,
|
||||
"arguments": {
|
||||
"x-dead-letter-exchange": "attachments.invalid",
|
||||
"x-dead-letter-routing-key": "invalid"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "attachments.v1.invalid",
|
||||
"vhost": "attachments",
|
||||
"durable": true,
|
||||
"auto_delete": false,
|
||||
"arguments": {}
|
||||
}
|
||||
],
|
||||
"exchanges": [
|
||||
{
|
||||
"name": "attachments.invalid",
|
||||
"vhost": "attachments",
|
||||
"type": "direct",
|
||||
"durable": true,
|
||||
"auto_delete": false,
|
||||
"internal": false,
|
||||
"arguments": {}
|
||||
}
|
||||
],
|
||||
"bindings": [
|
||||
{
|
||||
"source": "attachments.invalid",
|
||||
"vhost": "attachments",
|
||||
"destination": "attachments.v1.invalid",
|
||||
"destination_type": "queue",
|
||||
"routing_key": "invalid",
|
||||
"arguments": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
[rabbitmq_auth_mechanism_ssl].
|
||||
@@ -0,0 +1,11 @@
|
||||
listeners.tcp = none
|
||||
listeners.ssl.default = 5671
|
||||
ssl_options.cacertfile = /run/identity/ca.crt
|
||||
ssl_options.certfile = /run/identity/tls.crt
|
||||
ssl_options.keyfile = /run/identity/tls.key
|
||||
ssl_options.verify = verify_peer
|
||||
ssl_options.fail_if_no_peer_cert = true
|
||||
auth_mechanisms.1 = EXTERNAL
|
||||
ssl_cert_login_from = common_name
|
||||
loopback_users = none
|
||||
load_definitions = /run/identity/definitions.json
|
||||
Reference in New Issue
Block a user