ЛР 7 — БВТ2303 — Брезгунова — на 5
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
groups:
|
||||
- name: lab6-slo
|
||||
interval: 3s
|
||||
rules:
|
||||
- record: messenger:api_error_ratio:15s
|
||||
expr: sum(rate(http_server_requests_total{service_name="messenger-api",status_class="5xx"}[15s])) / clamp_min(sum(rate(http_server_requests_total{service_name="messenger-api"}[15s])), 0.001)
|
||||
- record: messenger:api_error_ratio:60s
|
||||
expr: sum(rate(http_server_requests_total{service_name="messenger-api",status_class="5xx"}[60s])) / clamp_min(sum(rate(http_server_requests_total{service_name="messenger-api"}[60s])), 0.001)
|
||||
- alert: APIHighErrorRate
|
||||
expr: messenger:api_error_ratio:15s > 0.05
|
||||
for: 6s
|
||||
labels: {severity: warning}
|
||||
annotations:
|
||||
summary: Business API 5xx exceeds 5 percent over 15 seconds
|
||||
runbook_url: https://localhost:3007/d/messenger-lab7
|
||||
description: See RUNBOOK.md. Use storage.failure logs and db spans to distinguish DB failure from handler latency.
|
||||
- alert: APIErrorBudgetBurn
|
||||
expr: (messenger:api_error_ratio:15s / 0.01 > 6) and (messenger:api_error_ratio:60s / 0.01 > 6)
|
||||
for: 10s
|
||||
labels: {severity: critical}
|
||||
annotations:
|
||||
summary: API 99 percent SLO consumes budget at more than 6x in both windows
|
||||
description: Educational compressed windows 15s and 60s; see RUNBOOK.md for production limitations.
|
||||
- alert: QueueLagGrowing
|
||||
expr: max(queue_oldest_age_seconds{service_name="messenger-publisher"}) > 10 and max(deriv(queue_oldest_age_seconds{service_name="messenger-publisher"}[15s])) > 0.1
|
||||
for: 6s
|
||||
labels: {severity: warning}
|
||||
annotations:
|
||||
summary: Durable backlog age exceeds 10 seconds and grows
|
||||
description: Check worker busy/capacity, job completions, consumer logs and trace. Restore worker and verify backlog drains.
|
||||
- alert: ReadyErrorBudgetBurn
|
||||
expr: ((sum(rate(attachment_ready_duration_seconds_count[15s])) - sum(rate(attachment_ready_duration_seconds_bucket{le="10"}[15s]))) / clamp_min(sum(rate(attachment_ready_duration_seconds_count[15s])),0.001) / 0.05 > 3) and ((sum(rate(attachment_ready_duration_seconds_count[60s])) - sum(rate(attachment_ready_duration_seconds_bucket{le="10"}[60s]))) / clamp_min(sum(rate(attachment_ready_duration_seconds_count[60s])),0.001) / 0.05 > 3)
|
||||
for: 6s
|
||||
labels: {severity: warning}
|
||||
annotations:
|
||||
summary: Ready within 10s SLO budget burns in both windows
|
||||
description: Completed-job SLI has survivorship delay; QueueLagGrowing covers uncompleted jobs. See RUNBOOK.md.
|
||||
@@ -0,0 +1,53 @@
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc: {endpoint: "127.0.0.1:4317"}
|
||||
http: {endpoint: "127.0.0.1:4318"}
|
||||
processors:
|
||||
memory_limiter:
|
||||
check_interval: 1s
|
||||
limit_mib: 192
|
||||
spike_limit_mib: 48
|
||||
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:
|
||||
endpoint: https://tempo:4438
|
||||
tls: {ca_file: /run/pki/ca.crt, cert_file: /run/tls/cert.crt, key_file: /run/tls/key.key}
|
||||
timeout: 2s
|
||||
sending_queue: {enabled: true, num_consumers: 2, queue_size: 64}
|
||||
retry_on_failure: {enabled: true, initial_interval: 1s, max_interval: 5s, max_elapsed_time: 15s}
|
||||
otlphttp/loki:
|
||||
endpoint: https://loki:3443/otlp
|
||||
tls: {ca_file: /run/pki/ca.crt, cert_file: /run/tls/cert.crt, key_file: /run/tls/key.key}
|
||||
timeout: 2s
|
||||
sending_queue: {enabled: true, num_consumers: 2, queue_size: 64}
|
||||
retry_on_failure: {enabled: true, initial_interval: 1s, max_interval: 5s, max_elapsed_time: 15s}
|
||||
extensions:
|
||||
health_check: {endpoint: "127.0.0.1:13133"}
|
||||
service:
|
||||
extensions: [health_check]
|
||||
telemetry:
|
||||
metrics:
|
||||
readers:
|
||||
- pull:
|
||||
exporter:
|
||||
prometheus: {host: "127.0.0.1", 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: [otlphttp/tempo]
|
||||
@@ -0,0 +1,24 @@
|
||||
auth_enabled: false
|
||||
server: {http_listen_address: 127.0.0.1, http_listen_port: 3100, grpc_listen_address: 127.0.0.1}
|
||||
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
|
||||
compactor:
|
||||
working_directory: /loki/compactor
|
||||
retention_enabled: true
|
||||
delete_request_store: filesystem
|
||||
analytics: {reporting_enabled: false}
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"global": {
|
||||
"scrape_interval": "3s",
|
||||
"evaluation_interval": "3s"
|
||||
},
|
||||
"rule_files": [
|
||||
"/etc/prometheus/alerts.yaml"
|
||||
],
|
||||
"scrape_configs": [
|
||||
{
|
||||
"job_name": "messenger",
|
||||
"scheme": "https",
|
||||
"tls_config": {
|
||||
"ca_file": "/run/pki/ca.crt",
|
||||
"cert_file": "/run/tls/cert.crt",
|
||||
"key_file": "/run/tls/key.key"
|
||||
},
|
||||
"static_configs": [
|
||||
{
|
||||
"targets": [
|
||||
"otel-collector:8890"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"job_name": "collector",
|
||||
"scheme": "https",
|
||||
"tls_config": {
|
||||
"ca_file": "/run/pki/ca.crt",
|
||||
"cert_file": "/run/tls/cert.crt",
|
||||
"key_file": "/run/tls/key.key"
|
||||
},
|
||||
"static_configs": [
|
||||
{
|
||||
"targets": [
|
||||
"otel-collector:8887"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
server: {http_listen_address: 127.0.0.1, http_listen_port: 3200, grpc_listen_address: 127.0.0.1}
|
||||
distributor:
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc: {endpoint: "127.0.0.1:4317"}
|
||||
http: {endpoint: "127.0.0.1:4318"}
|
||||
ingester: {max_block_duration: 5m, lifecycler: {address: 127.0.0.1}}
|
||||
compactor:
|
||||
compaction: {block_retention: 168h}
|
||||
storage:
|
||||
trace:
|
||||
backend: local
|
||||
wal: {path: /var/tempo/wal}
|
||||
local: {path: /var/tempo/blocks}
|
||||
usage_report: {reporting_enabled: false}
|
||||
Reference in New Issue
Block a user