Download partial/afx-e1-s03/solve.sh from openenvforge/3ambench: direct link, hf CLI and curl.
- Browser
- Download file 26.7 kB
-
https://huggingface.co/datasets/openenvforge/3ambench/resolve/main/partial/afx-e1-s03/solve.sh
- Command line
-
hf download hf://datasets/openenvforge/3ambench/partial/afx-e1-s03/solve.sh
-
curl -L -o solve.sh https://huggingface.co/datasets/openenvforge/3ambench/resolve/main/partial/afx-e1-s03/solve.sh
26.7 kB
| # partial: even-indexed requirements + one plausible mistake | |
| set -euo pipefail | |
| cd /workspace/monitoring | |
| mkdir -p 'alertmanager' | |
| cat > 'alertmanager/alertmanager.yml' <<'AF_EOF' | |
| # Shared Alertmanager config (this repo, platform and data Prometheus servers). | |
| # Receivers belong to the teams; ask before touching someone else's. | |
| global: | |
| resolve_timeout: 5m | |
| slack_api_url_file: /etc/alertmanager/secrets/slack-url | |
| templates: | |
| - /etc/alertmanager/templates/*.tmpl | |
| route: | |
| receiver: slack-alerts-default | |
| group_by: [alertname, service] | |
| group_wait: 30s | |
| group_interval: 5m | |
| repeat_interval: 4h | |
| routes: | |
| # rule evaluation problems. Nobody pages on these (yet). | |
| - matchers: | |
| - alertname=~"PrometheusRuleFailures|PrometheusRuleEvaluationSlow" | |
| receiver: slack-prometheus-meta | |
| # SRE sees every page as FYI; owners get paged by their own subtree below. | |
| - matchers: | |
| - severity=~"page|critical" | |
| receiver: slack-sre-fyi | |
| continue: true | |
| # loyalty: still on the old match syntax | |
| - match: | |
| team: loyalty | |
| receiver: slack-loyalty | |
| routes: | |
| - match_re: | |
| severity: page|critical | |
| receiver: pagerduty-loyalty | |
| continue: true | |
| - match: | |
| severity: ticket | |
| receiver: jira-loyalty | |
| continue: true | |
| - receiver: slack-loyalty | |
| - matchers: | |
| - team="booking" | |
| receiver: slack-booking | |
| routes: | |
| - matchers: | |
| - severity=~"page|critical" | |
| receiver: pagerduty-booking | |
| continue: true | |
| - matchers: | |
| - severity="ticket" | |
| receiver: jira-booking | |
| continue: true | |
| - receiver: slack-booking | |
| - matchers: | |
| - team="inventory" | |
| receiver: slack-inventory | |
| routes: | |
| - matchers: | |
| - severity=~"page|critical" | |
| receiver: pagerduty-inventory | |
| continue: true | |
| - matchers: | |
| - severity="ticket" | |
| receiver: jira-inventory | |
| continue: true | |
| - receiver: slack-inventory | |
| - matchers: | |
| - team="partner-feeds" | |
| receiver: slack-partner-feeds | |
| routes: | |
| - matchers: | |
| - severity=~"page|critical" | |
| receiver: pagerduty-partner-feeds | |
| continue: true | |
| - matchers: | |
| - severity="ticket" | |
| receiver: jira-partner-feeds | |
| continue: true | |
| - receiver: slack-partner-feeds | |
| # inventory services from before team labels were everywhere | |
| - matchers: | |
| - service=~"inventory-sync|seatmap-svc" | |
| receiver: slack-inventory | |
| routes: | |
| - matchers: | |
| - severity=~"page|critical" | |
| receiver: pagerduty-inventory | |
| continue: true | |
| - receiver: slack-inventory | |
| - matchers: | |
| - team="airport-ops" | |
| receiver: slack-airport-ops | |
| routes: | |
| - matchers: | |
| - severity=~"page|critical" | |
| receiver: pagerduty-airport-ops | |
| continue: true | |
| - matchers: | |
| - severity="ticket" | |
| receiver: jira-airport-ops | |
| continue: true | |
| - receiver: slack-airport-ops | |
| # teams below route alerts from the platform and data Prometheus servers | |
| - matchers: | |
| - team="edge" | |
| receiver: slack-edge | |
| routes: | |
| - matchers: | |
| - severity=~"page|critical" | |
| receiver: pagerduty-edge | |
| continue: true | |
| - matchers: | |
| - severity="ticket" | |
| receiver: jira-edge | |
| continue: true | |
| - receiver: slack-edge | |
| - matchers: | |
| - team="platform" | |
| receiver: slack-platform | |
| routes: | |
| - matchers: | |
| - severity=~"page|critical" | |
| receiver: pagerduty-platform | |
| continue: true | |
| - matchers: | |
| - severity="ticket" | |
| receiver: jira-platform | |
| continue: true | |
| - receiver: slack-platform | |
| # messaging: fewer updates per group, too chatty at 5m | |
| - matchers: | |
| - team="messaging" | |
| receiver: slack-messaging | |
| group_interval: 10m | |
| routes: | |
| - matchers: | |
| - severity=~"page|critical" | |
| receiver: pagerduty-messaging | |
| continue: true | |
| - matchers: | |
| - severity="ticket" | |
| receiver: jira-messaging | |
| continue: true | |
| - receiver: slack-messaging | |
| # build-infra asked for hourly repeats while something is still firing | |
| - matchers: | |
| - team="build-infra" | |
| receiver: slack-build-infra | |
| repeat_interval: 1h | |
| routes: | |
| - matchers: | |
| - severity=~"page|critical" | |
| receiver: pagerduty-build-infra | |
| continue: true | |
| - matchers: | |
| - severity="ticket" | |
| receiver: jira-build-infra | |
| continue: true | |
| # tickets and warnings per pod in Slack, so the channel shows which pod; pages group per service above | |
| - receiver: slack-build-infra | |
| group_by: [alertname, pod, service] | |
| - matchers: | |
| - team="data-platform" | |
| receiver: slack-data-platform | |
| routes: | |
| - matchers: | |
| - severity=~"page|critical" | |
| receiver: pagerduty-data-platform | |
| continue: true | |
| - matchers: | |
| - severity="ticket" | |
| receiver: jira-data-platform | |
| continue: true | |
| - receiver: slack-data-platform | |
| - matchers: | |
| - team="security-ops" | |
| receiver: slack-security-ops | |
| routes: | |
| - matchers: | |
| - severity=~"page|critical" | |
| receiver: pagerduty-security-ops | |
| continue: true | |
| - matchers: | |
| - severity="ticket" | |
| receiver: jira-security-ops | |
| continue: true | |
| - receiver: slack-security-ops | |
| # ml-platform wanted tickets in Slack as well as Jira (SRE-1149) | |
| - matchers: | |
| - team="ml-platform" | |
| receiver: slack-ml-platform | |
| routes: | |
| - matchers: | |
| - severity=~"page|critical" | |
| receiver: pagerduty-ml-platform | |
| continue: true | |
| - matchers: | |
| - severity="ticket" | |
| receiver: jira-ml-platform | |
| continue: true | |
| - receiver: slack-ml-platform | |
| receivers: | |
| - name: slack-alerts-default | |
| slack_configs: | |
| - channel: "#alerts-default" | |
| send_resolved: true | |
| - name: slack-sre-fyi | |
| slack_configs: | |
| - channel: "#sre-fyi" | |
| send_resolved: false | |
| - name: slack-prometheus-meta | |
| slack_configs: | |
| - channel: "#prometheus-meta" | |
| - name: pagerduty-sre | |
| pagerduty_configs: | |
| - routing_key_file: /etc/alertmanager/secrets/pagerduty/sre | |
| - name: pagerduty-airport-ops | |
| pagerduty_configs: | |
| - routing_key_file: /etc/alertmanager/secrets/pagerduty/airport-ops | |
| - name: slack-airport-ops | |
| slack_configs: | |
| - channel: "#airport-ops-alerts" | |
| send_resolved: true | |
| - name: jira-airport-ops | |
| webhook_configs: | |
| - url: https://jira-bridge.corp.inntrail.example/hooks/airport_ops | |
| - name: pagerduty-booking | |
| pagerduty_configs: | |
| - routing_key_file: /etc/alertmanager/secrets/pagerduty/booking | |
| - name: slack-booking | |
| slack_configs: | |
| - channel: "#booking-alerts" | |
| send_resolved: true | |
| - name: jira-booking | |
| webhook_configs: | |
| - url: https://jira-bridge.corp.inntrail.example/hooks/booking | |
| - name: pagerduty-build-infra | |
| pagerduty_configs: | |
| - routing_key_file: /etc/alertmanager/secrets/pagerduty/build-infra | |
| - name: slack-build-infra | |
| slack_configs: | |
| - channel: "#build-infra-alerts" | |
| send_resolved: true | |
| - name: jira-build-infra | |
| webhook_configs: | |
| - url: https://jira-bridge.corp.inntrail.example/hooks/build_infra | |
| - name: pagerduty-data-platform | |
| pagerduty_configs: | |
| - routing_key_file: /etc/alertmanager/secrets/pagerduty/data-platform | |
| - name: slack-data-platform | |
| slack_configs: | |
| - channel: "#data-platform-alerts" | |
| send_resolved: true | |
| - name: jira-data-platform | |
| webhook_configs: | |
| - url: https://jira-bridge.corp.inntrail.example/hooks/data_platform | |
| - name: pagerduty-edge | |
| pagerduty_configs: | |
| - routing_key_file: /etc/alertmanager/secrets/pagerduty/edge | |
| - name: slack-edge | |
| slack_configs: | |
| - channel: "#edge-alerts" | |
| send_resolved: true | |
| - name: jira-edge | |
| webhook_configs: | |
| - url: https://jira-bridge.corp.inntrail.example/hooks/edge | |
| - name: pagerduty-inventory | |
| pagerduty_configs: | |
| - routing_key_file: /etc/alertmanager/secrets/pagerduty/inventory | |
| - name: slack-inventory | |
| slack_configs: | |
| - channel: "#inventory-alerts" | |
| send_resolved: true | |
| - name: jira-inventory | |
| webhook_configs: | |
| - url: https://jira-bridge.corp.inntrail.example/hooks/inventory | |
| - name: pagerduty-loyalty | |
| pagerduty_configs: | |
| - routing_key_file: /etc/alertmanager/secrets/pagerduty/loyalty | |
| - name: slack-loyalty | |
| slack_configs: | |
| - channel: "#loyalty-alerts" | |
| send_resolved: true | |
| - name: jira-loyalty | |
| webhook_configs: | |
| - url: https://jira-bridge.corp.inntrail.example/hooks/loyalty | |
| - name: pagerduty-messaging | |
| pagerduty_configs: | |
| - routing_key_file: /etc/alertmanager/secrets/pagerduty/messaging | |
| - name: slack-messaging | |
| slack_configs: | |
| - channel: "#messaging-alerts" | |
| send_resolved: true | |
| - name: jira-messaging | |
| webhook_configs: | |
| - url: https://jira-bridge.corp.inntrail.example/hooks/messaging | |
| - name: pagerduty-ml-platform | |
| pagerduty_configs: | |
| - routing_key_file: /etc/alertmanager/secrets/pagerduty/ml-platform | |
| - name: slack-ml-platform | |
| slack_configs: | |
| - channel: "#ml-platform-alerts" | |
| send_resolved: true | |
| - name: jira-ml-platform | |
| webhook_configs: | |
| - url: https://jira-bridge.corp.inntrail.example/hooks/ml_platform | |
| - name: pagerduty-partner-feeds | |
| pagerduty_configs: | |
| - routing_key_file: /etc/alertmanager/secrets/pagerduty/partner-feeds | |
| - name: slack-partner-feeds | |
| slack_configs: | |
| - channel: "#partner-feeds-alerts" | |
| send_resolved: true | |
| - name: jira-partner-feeds | |
| webhook_configs: | |
| - url: https://jira-bridge.corp.inntrail.example/hooks/partner_feeds | |
| - name: pagerduty-platform | |
| pagerduty_configs: | |
| - routing_key_file: /etc/alertmanager/secrets/pagerduty/platform | |
| - name: slack-platform | |
| slack_configs: | |
| - channel: "#platform-alerts" | |
| send_resolved: true | |
| - name: jira-platform | |
| webhook_configs: | |
| - url: https://jira-bridge.corp.inntrail.example/hooks/platform | |
| - name: pagerduty-security-ops | |
| pagerduty_configs: | |
| - routing_key_file: /etc/alertmanager/secrets/pagerduty/security-ops | |
| - name: slack-security-ops | |
| slack_configs: | |
| - channel: "#security-ops-alerts" | |
| send_resolved: true | |
| - name: jira-security-ops | |
| webhook_configs: | |
| - url: https://jira-bridge.corp.inntrail.example/hooks/security_ops | |
| # nothing routes here since the rota moved to PagerDuty; ask before deleting | |
| - name: slack-old-oncall | |
| slack_configs: | |
| - channel: "#oncall-old" | |
| send_resolved: true | |
| inhibit_rules: | |
| # a critical copy holds back the warning copy of the same alert | |
| - source_matchers: | |
| - severity="critical" | |
| target_matchers: | |
| - severity="warning" | |
| equal: [alertname, service] | |
| AF_EOF | |
| mkdir -p 'rules' | |
| cat > 'rules/booking-rules.yaml' <<'AF_EOF' | |
| apiVersion: monitoring.coreos.com/v1 | |
| kind: PrometheusRule | |
| metadata: | |
| name: booking-rules | |
| namespace: monitoring | |
| labels: | |
| role: alert-rules | |
| spec: | |
| groups: | |
| - name: booking-api | |
| rules: | |
| - alert: BookingApiDown | |
| expr: | | |
| sum by (service) (up{service="booking-api"}) == 0 | |
| or absent(up{service="booking-api"}) | |
| for: 3m | |
| labels: | |
| severity: page | |
| team: booking | |
| annotations: | |
| summary: booking-api has no healthy scrape targets | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/BookingApiDown | |
| - alert: BookingApiHighErrorRatio | |
| expr: | | |
| sum by (service) (rate(http_requests_total{service="booking-api",code=~"5.."}[5m])) | |
| / sum by (service) (rate(http_requests_total{service="booking-api"}[5m])) > 0.02 | |
| for: 10m | |
| labels: | |
| severity: page | |
| team: booking | |
| annotations: | |
| summary: "{{ $labels.service }} is failing {{ $value | humanizePercentage }} of requests" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/BookingApiHighErrorRatio | |
| - alert: BookingApiErrorBudgetBurnFast | |
| expr: | | |
| slo:sli_error:ratio_rate1h{service="booking-api"} > (14.4 * 0.0005) | |
| and slo:sli_error:ratio_rate5m{service="booking-api"} > (14.4 * 0.0005) | |
| for: 2m | |
| labels: | |
| severity: page | |
| team: booking | |
| slo: booking-api-availability | |
| annotations: | |
| summary: "{{ $labels.service }} is spending its error budget fast" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/BookingApiErrorBudgetBurnFast | |
| - alert: BookingApiErrorBudgetBurnSlow | |
| expr: | | |
| slo:sli_error:ratio_rate6h{service="booking-api"} > (6 * 0.0005) | |
| and slo:sli_error:ratio_rate30m{service="booking-api"} > (6 * 0.0005) | |
| for: 15m | |
| labels: | |
| severity: ticket | |
| team: booking | |
| slo: booking-api-availability | |
| annotations: | |
| summary: "{{ $labels.service }} is spending its error budget steadily" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/BookingApiErrorBudgetBurnSlow | |
| - name: pnr-worker | |
| rules: | |
| - alert: PnrWorkerDown | |
| expr: | | |
| sum by (service) (up{service="pnr-worker"}) == 0 | |
| or absent(up{service="pnr-worker"}) | |
| for: 3m | |
| labels: | |
| severity: page | |
| team: booking | |
| annotations: | |
| summary: pnr-worker has no healthy scrape targets | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/PnrWorkerDown | |
| - alert: PnrWorkerHighErrorRatio | |
| expr: | | |
| sum by (service) (rate(http_requests_total{service="pnr-worker",code=~"5.."}[5m])) | |
| / sum by (service) (rate(http_requests_total{service="pnr-worker"}[5m])) > 0.05 | |
| for: 10m | |
| labels: | |
| severity: page | |
| team: booking | |
| annotations: | |
| summary: "{{ $labels.service }} is failing {{ $value | humanizePercentage }} of requests" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/PnrWorkerHighErrorRatio | |
| - name: booking-worker | |
| rules: | |
| - alert: BookingWorkerDown | |
| expr: | | |
| sum by (service) (up{service="booking-worker"}) == 0 | |
| or absent(up{service="booking-worker"}) | |
| for: 3m | |
| labels: | |
| severity: page | |
| team: booking | |
| annotations: | |
| summary: booking-worker has no healthy scrape targets | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/BookingWorkerDown | |
| - alert: BookingWorkerHighErrorRatio | |
| expr: | | |
| sum by (service) (rate(http_requests_total{service="booking-worker",code=~"5.."}[5m])) | |
| / sum by (service) (rate(http_requests_total{service="booking-worker"}[5m])) > 0.02 | |
| for: 10m | |
| labels: | |
| severity: page | |
| team: booking | |
| annotations: | |
| summary: "{{ $labels.service }} is failing {{ $value | humanizePercentage }} of requests" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/BookingWorkerHighErrorRatio | |
| # average the pods: they all run with the same limit, so the mean is what we size it by | |
| - alert: BookingWorkerCpuThrottled | |
| expr: | | |
| avg by (service) (rate(container_cpu_cfs_throttled_periods_total{service="booking-worker",container="booking-worker"}[5m]) / rate(container_cpu_cfs_periods_total{service="booking-worker",container="booking-worker"}[5m])) > 0.25 | |
| for: 30m | |
| labels: | |
| severity: ticket | |
| team: booking | |
| annotations: | |
| summary: "{{ $labels.service }} pods spend over a quarter of their CPU periods throttled" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/BookingWorkerCpuThrottled | |
| AF_EOF | |
| mkdir -p 'rules' | |
| cat > 'rules/legacy-inventory.yml' <<'AF_EOF' | |
| # inventory alerts from before the conventions in README.md. | |
| # Don't reformat in passing; move things out when you touch them for a reason. | |
| groups: | |
| # old dashboard records; the svc-overview board still reads these | |
| - name: inventory-records | |
| rules: | |
| # keep: finance reads this one for the monthly availability report | |
| - record: job:grpc_calls:rate5m | |
| expr: sum by (job, service) (rate(grpc_server_handled_total{service="seatmap-svc"}[5m])) | |
| - record: job:grpc_errors:rate5m | |
| expr: sum by (job, service) (rate(grpc_server_handled_total{service="seatmap-svc",grpc_code=~"Unavailable|Internal|DeadlineExceeded|Unknown|DataLoss"}[5m])) | |
| - record: job:http_requests:rate5m | |
| expr: sum by (job, service) (rate(http_requests_total{service=~"checkin-api|inventory-sync"}[5m])) | |
| - record: job:http_errors:rate5m | |
| expr: sum by (job, service) (rate(http_requests_total{service=~"checkin-api|inventory-sync",code=~"5.."}[5m])) | |
| - name: checkin-api | |
| rules: | |
| - alert: CheckinApiHighErrorRatio | |
| expr: sum by (service) (rate(http_requests_total{service="checkin-api",code=~"5.."}[5m])) / sum by (service) (rate(http_requests_total{service="checkin-api"}[5m])) > 0.05 | |
| for: "10m" | |
| labels: {severity: page, team: airport-ops} | |
| annotations: | |
| summary: "{{ $labels.service }} is failing {{ $value | humanizePercentage }} of requests" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/CheckinApiHighErrorRatio | |
| - alert: CheckinApiLatencyHigh | |
| expr: histogram_quantile(0.99, sum by (service, le) (rate(http_request_duration_seconds_bucket{service="checkin-api"}[5m]))) > 0.5 | |
| for: "10m" | |
| labels: {severity: warning, team: inventory} | |
| annotations: | |
| summary: "{{ $labels.service }} p99 above 500ms" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/CheckinApiLatencyHigh | |
| - alert: CheckinApiLatencyHigh | |
| expr: histogram_quantile(0.99, sum by (service, le) (rate(http_request_duration_seconds_bucket{service="checkin-api"}[5m]))) > 1 | |
| for: "10m" | |
| labels: {severity: critical, team: airport-ops} | |
| annotations: | |
| summary: "{{ $labels.service }} p99 above 1s" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/CheckinApiLatencyHigh | |
| - alert: CheckinApiDbConnectionsHigh | |
| expr: max by (service) (db_pool_connections_active{service="checkin-api"} / db_pool_connections_max{service="checkin-api"}) > 0.8 | |
| for: "5m" | |
| labels: {severity: warning, team: airport-ops} | |
| annotations: | |
| summary: "{{ $labels.service }} is using over 80% of its DB pool" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/CheckinApiDbConnectionsHigh | |
| - alert: CheckinApiDbConnectionsHigh | |
| expr: max by (service) (db_pool_connections_active{service="checkin-api"} / db_pool_connections_max{service="checkin-api"}) > 0.95 | |
| for: "5m" | |
| labels: {severity: critical, team: airport-ops} | |
| annotations: | |
| summary: "{{ $labels.service }} DB pool nearly exhausted" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/CheckinApiDbConnectionsHigh | |
| - name: inventory-sync | |
| rules: | |
| - alert: InventorySyncHighErrorRatio | |
| expr: sum by (service) (rate(http_requests_total{service="inventory-sync",code=~"5.."}[5m])) / sum by (service) (rate(http_requests_total{service="inventory-sync"}[5m])) > 0.02 | |
| for: "10m" | |
| labels: {severity: page, team: inventory} | |
| annotations: | |
| summary: "{{ $labels.service }} is failing {{ $value | humanizePercentage }} of requests" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/InventorySyncHighErrorRatio | |
| - alert: InventorySyncDbConnectionsHigh | |
| expr: max by (service) (db_pool_connections_active{service="inventory-sync"} / db_pool_connections_max{service="inventory-sync"}) > 0.8 | |
| for: "5m" | |
| labels: {severity: warning, team: inventory} | |
| annotations: | |
| summary: "{{ $labels.service }} is using over 80% of its DB pool" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/InventorySyncDbConnectionsHigh | |
| - alert: InventorySyncDbConnectionsHigh | |
| expr: max by (service) (db_pool_connections_active{service="inventory-sync"} / db_pool_connections_max{service="inventory-sync"}) > 0.95 | |
| for: "5m" | |
| labels: {severity: critical, team: inventory} | |
| annotations: | |
| summary: "{{ $labels.service }} DB pool nearly exhausted" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/InventorySyncDbConnectionsHigh | |
| - alert: InventorySyncQueueBacklogHigh | |
| expr: max by (service) (work_queue_depth{service="inventory-sync"}) > 5000 | |
| for: "15m" | |
| labels: {severity: page, team: inventory} | |
| annotations: | |
| summary: "{{ $labels.service }} has more than 5000 jobs waiting" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/InventorySyncQueueBacklogHigh | |
| - name: seatmap-svc | |
| rules: | |
| # threshold agreed with inventory in SRE-1788 | |
| - alert: SeatmapSvcHighErrorRatio | |
| expr: sum by (service) (rate(grpc_server_handled_total{service="seatmap-svc",grpc_code=~"Unavailable|Internal|DeadlineExceeded|Unknown|DataLoss"}[5m])) / sum by (service) (rate(grpc_server_handled_total{service="seatmap-svc"}[5m])) > 0.1 | |
| for: "10m" | |
| labels: {severity: page, team: inventory} | |
| annotations: | |
| summary: "{{ $labels.service }} is failing {{ $value | humanizePercentage }} of requests" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/SeatmapSvcHighErrorRatio | |
| AF_EOF | |
| mkdir -p 'rules' | |
| cat > 'rules/legacy-partner-feeds.yml' <<'AF_EOF' | |
| # partner-feeds alerts from before the conventions in README.md. | |
| # Don't reformat in passing; move things out when you touch them for a reason. | |
| groups: | |
| # old dashboard records; the svc-overview board still reads these | |
| - name: partner-feeds-records | |
| rules: | |
| - record: job:http_requests:rate5m | |
| expr: sum by (job, service) (rate(http_requests_total{service="fare-quotes"}[5m])) | |
| - record: job:http_errors:rate5m | |
| expr: sum by (job, service) (rate(http_requests_total{service="fare-quotes",code=~"5.."}[5m])) | |
| - name: fare-quotes | |
| rules: | |
| - alert: FareQuotesHighErrorRatio | |
| expr: sum by (service) (rate(http_requests_total{service="fare-quotes",code=~"5.."}[5m])) / sum by (service) (rate(http_requests_total{service="fare-quotes"}[5m])) > 0.02 | |
| for: "10m" | |
| labels: {severity: page, team: partner-feeds} | |
| annotations: | |
| summary: "{{ $labels.service }} is failing {{ $value | humanizePercentage }} of requests" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/FareQuotesHighErrorRatio | |
| - alert: FareQuotesLatencyHigh | |
| expr: histogram_quantile(0.99, sum by (service, le) (rate(http_request_duration_seconds_bucket{service="fare-quotes"}[5m]))) > 0.5 | |
| for: "10m" | |
| labels: {severity: warning, team: partner-feeds} | |
| annotations: | |
| summary: "{{ $labels.service }} p99 above 500ms" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/FareQuotesLatencyHigh | |
| - alert: FareQuotesLatencyHigh | |
| expr: histogram_quantile(0.99, sum by (service, le) (rate(http_request_duration_seconds_bucket{service="fare-quotes"}[5m]))) > 1 | |
| for: "10m" | |
| labels: {severity: critical, team: partner-feeds} | |
| annotations: | |
| summary: "{{ $labels.service }} p99 above 1s" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/FareQuotesLatencyHigh | |
| - alert: FareQuotesDbConnectionsHigh | |
| expr: max by (service) (db_pool_connections_active{service="fare-quotes"} / db_pool_connections_max{service="fare-quotes"}) > 0.8 | |
| for: "5m" | |
| labels: {severity: warning, team: partner-feeds} | |
| annotations: | |
| summary: "{{ $labels.service }} is using over 80% of its DB pool" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/FareQuotesDbConnectionsHigh | |
| - alert: FareQuotesDbConnectionsHigh | |
| expr: max by (service) (db_pool_connections_active{service="fare-quotes"} / db_pool_connections_max{service="fare-quotes"}) > 0.95 | |
| for: "5m" | |
| labels: {severity: critical, team: partner-feeds} | |
| annotations: | |
| summary: "{{ $labels.service }} DB pool nearly exhausted" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/FareQuotesDbConnectionsHigh | |
| AF_EOF | |
| mkdir -p 'rules' | |
| cat > 'rules/service-health.yml' <<'AF_EOF' | |
| # One Down alert per service. See README, Service health. | |
| groups: | |
| - name: service-health | |
| rules: | |
| - alert: CheckinApiDown | |
| expr: | | |
| sum by (service) (up{service="checkin-api"}) == 0 | |
| or absent(up{service="checkin-api"}) | |
| for: 3m | |
| labels: | |
| severity: page | |
| team: airport-ops | |
| annotations: | |
| summary: checkin-api has no healthy scrape targets | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/CheckinApiDown | |
| # absent() too: fare-quotes was scaled to zero by mistake once and the sum just went away | |
| - alert: FareQuotesDown | |
| expr: | | |
| sum by (service) (up{service="fare-quotes"}) == 0 | |
| or absent(up{service="fare-quotes"}) | |
| for: 3m | |
| labels: | |
| severity: page | |
| team: partner-feeds | |
| annotations: | |
| summary: fare-quotes has no healthy scrape targets | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/FareQuotesDown | |
| - alert: InventorySyncDown | |
| expr: | | |
| sum by (service) (up{service="inventory-sync"}) == 0 | |
| or absent(up{service="inventory-sync"}) | |
| for: 3m | |
| labels: | |
| severity: page | |
| team: inventory | |
| annotations: | |
| summary: inventory-sync has no healthy scrape targets | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/InventorySyncDown | |
| - alert: SeatmapSvcDown | |
| expr: | | |
| sum by (service) (up{service="seatmap-svc"}) == 0 | |
| or absent(up{service="seatmap-svc"}) | |
| for: 3m | |
| labels: | |
| severity: page | |
| team: inventory | |
| annotations: | |
| summary: seatmap-svc has no healthy scrape targets | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/SeatmapSvcDown | |
| - alert: HotelIndexerDown | |
| expr: | | |
| sum by (service) (up{service="hotel-indexer"}) == 0 | |
| or absent(up{service="hotel-indexer"}) | |
| for: 3m | |
| labels: | |
| severity: page | |
| team: partner-feeds | |
| annotations: | |
| summary: hotel-indexer has no healthy scrape targets | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/HotelIndexerDown | |
| - alert: LoyaltyPointsDown | |
| expr: | | |
| sum by (service) (up{service="loyalty-points"}) == 0 | |
| or absent(up{service="loyalty-points"}) | |
| for: 3m | |
| labels: | |
| severity: page | |
| team: loyalty | |
| annotations: | |
| summary: loyalty-points has no healthy scrape targets | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/LoyaltyPointsDown | |
| AF_EOF | |
| mkdir -p 'rules' | |
| cat > 'rules/slo-checkin-api.yml' <<'AF_EOF' | |
| groups: | |
| - name: slo-checkin-api | |
| rules: | |
| - alert: CheckinApiErrorBudgetBurnFast | |
| expr: | | |
| slo:sli_error:ratio_rate1h{service="checkin-api"} > (14.4 * 0.0005) | |
| and slo:sli_error:ratio_rate5m{service="checkin-api"} > (14.4 * 0.0005) | |
| for: 2m | |
| labels: | |
| severity: page | |
| team: airport-ops | |
| slo: checkin-api-availability | |
| annotations: | |
| summary: "{{ $labels.service }} is spending its error budget fast" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/CheckinApiErrorBudgetBurnFast | |
| - alert: CheckinApiErrorBudgetBurnSlow | |
| expr: | | |
| slo:sli_error:ratio_rate6h{service="checkin-api"} > (6 * 0.0005) | |
| and slo:sli_error:ratio_rate30m{service="checkin-api"} > (6 * 0.0005) | |
| for: 15m | |
| labels: | |
| severity: ticket | |
| team: airport-ops | |
| slo: checkin-api-availability | |
| annotations: | |
| summary: "{{ $labels.service }} is spending its error budget steadily" | |
| runbook_url: https://runbooks.corp.inntrail.example/alerts/CheckinApiErrorBudgetBurnSlow | |
| AF_EOF | |