feat: complete lab 7 for grade 4
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,28 @@
|
||||
global:
|
||||
scrape_interval: 5s
|
||||
evaluation_interval: 5s
|
||||
rule_files: [/etc/prometheus/rules.yaml]
|
||||
scrape_configs:
|
||||
- job_name: application-otlp
|
||||
scheme: https
|
||||
tls_config: &scrape_tls
|
||||
ca_file: /run/trust/ca.crt
|
||||
cert_file: /run/identity/client.crt
|
||||
key_file: /run/identity/client.key
|
||||
scrape_protocols: [OpenMetricsText1.0.0, PrometheusText0.0.4]
|
||||
static_configs:
|
||||
- targets: [otel-collector:9464]
|
||||
- job_name: collector
|
||||
scheme: https
|
||||
tls_config: *scrape_tls
|
||||
static_configs:
|
||||
- targets: [otel-collector:8888]
|
||||
- job_name: ingress
|
||||
scheme: https
|
||||
tls_config: *scrape_tls
|
||||
metrics_path: /metrics
|
||||
static_configs:
|
||||
- targets: [lb:8404]
|
||||
- job_name: prometheus
|
||||
static_configs:
|
||||
- targets: [127.0.0.1:19090]
|
||||
@@ -0,0 +1,117 @@
|
||||
groups:
|
||||
- name: messenger-sli
|
||||
rules:
|
||||
- record: lab:sli_api_total:30s
|
||||
expr: sum(increase(haproxy_frontend_http_responses_total{proxy="public"}[30s]))
|
||||
- record: lab:sli_api_bad:30s
|
||||
expr: sum(increase(haproxy_frontend_http_responses_total{proxy="public",code="5xx"}[30s])) or 0 * sum(increase(haproxy_frontend_http_responses_total{proxy="public"}[30s]))
|
||||
- record: lab:sli_ready_total:30s
|
||||
expr: sum(lab_ready_cohort{window="30s",outcome="total"}) and on() (time() - max(lab_queue_sample_timestamp_seconds) < 15)
|
||||
- record: lab:sli_ready_bad:30s
|
||||
expr: sum(lab_ready_cohort{window="30s",outcome="bad"}) and on() (time() - max(lab_queue_sample_timestamp_seconds) < 15)
|
||||
- record: lab:burn_api:30s
|
||||
expr: (lab:sli_api_bad:30s / lab:sli_api_total:30s / 0.01) and (lab:sli_api_total:30s > 0)
|
||||
- record: lab:burn_ready:30s
|
||||
expr: (lab:sli_ready_bad:30s / lab:sli_ready_total:30s / 0.05) and (lab:sli_ready_total:30s > 0)
|
||||
- record: lab:sli_api_total:2m
|
||||
expr: sum(increase(haproxy_frontend_http_responses_total{proxy="public"}[2m]))
|
||||
- record: lab:sli_api_bad:2m
|
||||
expr: sum(increase(haproxy_frontend_http_responses_total{proxy="public",code="5xx"}[2m])) or 0 * sum(increase(haproxy_frontend_http_responses_total{proxy="public"}[2m]))
|
||||
- record: lab:sli_ready_total:2m
|
||||
expr: sum(lab_ready_cohort{window="2m",outcome="total"}) and on() (time() - max(lab_queue_sample_timestamp_seconds) < 15)
|
||||
- record: lab:sli_ready_bad:2m
|
||||
expr: sum(lab_ready_cohort{window="2m",outcome="bad"}) and on() (time() - max(lab_queue_sample_timestamp_seconds) < 15)
|
||||
- record: lab:burn_api:2m
|
||||
expr: (lab:sli_api_bad:2m / lab:sli_api_total:2m / 0.01) and (lab:sli_api_total:2m > 0)
|
||||
- record: lab:burn_ready:2m
|
||||
expr: (lab:sli_ready_bad:2m / lab:sli_ready_total:2m / 0.05) and (lab:sli_ready_total:2m > 0)
|
||||
- record: lab:sli_api_total:5m
|
||||
expr: sum(increase(haproxy_frontend_http_responses_total{proxy="public"}[5m]))
|
||||
- record: lab:sli_api_bad:5m
|
||||
expr: sum(increase(haproxy_frontend_http_responses_total{proxy="public",code="5xx"}[5m])) or 0 * sum(increase(haproxy_frontend_http_responses_total{proxy="public"}[5m]))
|
||||
- record: lab:sli_ready_total:5m
|
||||
expr: sum(lab_ready_cohort{window="5m",outcome="total"}) and on() (time() - max(lab_queue_sample_timestamp_seconds) < 15)
|
||||
- record: lab:sli_ready_bad:5m
|
||||
expr: sum(lab_ready_cohort{window="5m",outcome="bad"}) and on() (time() - max(lab_queue_sample_timestamp_seconds) < 15)
|
||||
- record: lab:burn_api:5m
|
||||
expr: (lab:sli_api_bad:5m / lab:sli_api_total:5m / 0.01) and (lab:sli_api_total:5m > 0)
|
||||
- record: lab:burn_ready:5m
|
||||
expr: (lab:sli_ready_bad:5m / lab:sli_ready_total:5m / 0.05) and (lab:sli_ready_total:5m > 0)
|
||||
- record: lab:sli_api_total:1h
|
||||
expr: sum(increase(haproxy_frontend_http_responses_total{proxy="public"}[1h]))
|
||||
- record: lab:sli_api_bad:1h
|
||||
expr: sum(increase(haproxy_frontend_http_responses_total{proxy="public",code="5xx"}[1h])) or 0 * sum(increase(haproxy_frontend_http_responses_total{proxy="public"}[1h]))
|
||||
- record: lab:sli_ready_total:1h
|
||||
expr: sum(lab_ready_cohort{window="1h",outcome="total"}) and on() (time() - max(lab_queue_sample_timestamp_seconds) < 15)
|
||||
- record: lab:sli_ready_bad:1h
|
||||
expr: sum(lab_ready_cohort{window="1h",outcome="bad"}) and on() (time() - max(lab_queue_sample_timestamp_seconds) < 15)
|
||||
- record: lab:burn_api:1h
|
||||
expr: (lab:sli_api_bad:1h / lab:sli_api_total:1h / 0.01) and (lab:sli_api_total:1h > 0)
|
||||
- record: lab:burn_ready:1h
|
||||
expr: (lab:sli_ready_bad:1h / lab:sli_ready_total:1h / 0.05) and (lab:sli_ready_total:1h > 0)
|
||||
- name: messenger-alerts
|
||||
rules:
|
||||
- alert: HighHTTPErrorRate
|
||||
expr: (lab:sli_api_bad:30s / lab:sli_api_total:30s > 0.10) and (lab:sli_api_total:30s >= 5)
|
||||
for: 10s
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
description: "More than 10% ingress 5xx over 30s with at least five responses."
|
||||
runbook_url: "infra/runbooks.md#api"
|
||||
- alert: QueueLag
|
||||
expr: (max(lab_oldest_job_age_seconds) > 15) and on() (time() - max(lab_queue_sample_timestamp_seconds) < 15)
|
||||
for: 10s
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
description: "Oldest unfinished image job has been older than 15s for 10s."
|
||||
runbook_url: "infra/runbooks.md#queue"
|
||||
- alert: APIBurnFast
|
||||
expr: (lab:burn_api:30s > 12) and (lab:burn_api:2m > 12) and (lab:sli_api_total:30s >= 8) and (lab:sli_api_total:2m >= 20)
|
||||
for: 10s
|
||||
labels:
|
||||
severity: critical
|
||||
annotations:
|
||||
description: "12x budget burn across both 30s and 2m."
|
||||
runbook_url: "infra/runbooks.md#api"
|
||||
- alert: APIBurnSlow
|
||||
expr: (lab:burn_api:2m > 4) and (lab:burn_api:5m > 4) and (lab:sli_api_total:2m >= 8) and (lab:sli_api_total:5m >= 20)
|
||||
for: 15s
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
description: "4x budget burn across both 2m and 5m."
|
||||
runbook_url: "infra/runbooks.md#api"
|
||||
- alert: ReadyBurnFast
|
||||
expr: (lab:burn_ready:30s > 12) and (lab:burn_ready:2m > 12) and (lab:sli_ready_total:30s >= 4) and (lab:sli_ready_total:2m >= 10)
|
||||
for: 10s
|
||||
labels:
|
||||
severity: critical
|
||||
annotations:
|
||||
description: "12x budget burn across both 30s and 2m."
|
||||
runbook_url: "infra/runbooks.md#queue"
|
||||
- alert: ReadyBurnSlow
|
||||
expr: (lab:burn_ready:2m > 4) and (lab:burn_ready:5m > 4) and (lab:sli_ready_total:2m >= 4) and (lab:sli_ready_total:5m >= 10)
|
||||
for: 15s
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
description: "4x budget burn across both 2m and 5m."
|
||||
runbook_url: "infra/runbooks.md#queue"
|
||||
- alert: TelemetryExportLoss
|
||||
expr: sum by (exporter) (increase(otelcol_exporter_send_failed_spans_total[30s])) > 0
|
||||
for: 5s
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
description: "Collector could not export one or more trace spans over 30s."
|
||||
runbook_url: "infra/runbooks.md#telemetry"
|
||||
- alert: TelemetryBacklogUnavailable
|
||||
expr: (time() - max(lab_queue_sample_timestamp_seconds) > 15) or absent(lab_queue_sample_timestamp_seconds)
|
||||
for: 15s
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
description: "No fresh PostgreSQL queue sample."
|
||||
runbook_url: "infra/runbooks.md#queue"
|
||||
Reference in New Issue
Block a user