Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Add runbooks for first API alarms (#2738)

Krystle Salazar00f7c775871b
diff --git a/documentation/meta/monitoring/runbooks/api_http_2xx_under_threshold.md b/documentation/meta/monitoring/runbooks/api_http_2xx_under_threshold.md
new file mode 100644
index 000000000..bcaf33a70
--- /dev/null
+++ b/documentation/meta/monitoring/runbooks/api_http_2xx_under_threshold.md
@@ -0,0 +1,35 @@
+# Run Book: API Production HTTP 2XX responses count under threshold
+
+```{admonition} Metadata
+Status: **Unstable**
+
+Maintainer: @krysaldb
+
+Alarm link:
+- <https://us-east-1.console.aws.amazon.com/cloudwatch/home?region=us-east-1#alarmsV2:alarm/API+Production+2XX+responses+count+under+threshold?>
+```
+
+## Severity Guide
+
+After confirming there is not a total outage, check if the overall request count
+has decreased as well (go to the [CloudWatch dashboard][cloudwatch] or
+alternatively check in CloudFlare). If the overall requests are lower then the
+severity is low, and you should continue searching for the cause of the general
+decrease.
+
+If the lower number is only in 2XX responses the severity is likely high, so
+also check the dashboard to look for other anomalies. Go to the [API
+logs][api_logs] to check for errors or data that yield clues.
+
+[cloudwatch]:
+ https://us-east-1.console.aws.amazon.com/cloudwatch/home?region=us-east-1#dashboards/dashboard/ECS-Production-Dashboard
+[api_logs]:
+ https://us-east-1.console.aws.amazon.com/cloudwatch/home?region=us-east-1#logsV2:log-groups/log-group/$252Fecs$252Fproduction$252Fapi
+
+## Historical false positives
+
+Nothing registered to date.
+
+## Related incident reports
+
+Nothing registered to date.
diff --git a/documentation/meta/monitoring/runbooks/api_http_5xx_above_threshold.md b/documentation/meta/monitoring/runbooks/api_http_5xx_above_threshold.md
new file mode 100644
index 000000000..6c90b62e7
--- /dev/null
+++ b/documentation/meta/monitoring/runbooks/api_http_5xx_above_threshold.md
@@ -0,0 +1,31 @@
+# Run Book: API Production HTTP 5XX responses count above threshold
+
+```{admonition} Metadata
+Status: **Unstable**
+
+Maintainer: @krysaldb
+
+Alarm link:
+- <https://us-east-1.console.aws.amazon.com/cloudwatch/home?region=us-east-1#alarmsV2:alarm/API+Production+2XX+responses+count+above+threshold?>
+```
+
+## Severity Guide
+
+After confirming there is not a total outage, check if the increase of 5XX HTTP
+errors is related to a regular time where resources are expected to be
+constrained like a recent deployment, a data refresh, DB maintenance, etc. If
+the spike is related to one of these events and the alarms stabilizes in the
+short time then the severity is low.
+
+If the issue is not related to known recurrent events and persists, the severity
+is critical. Check if dependent services –DB, Redis, Elasticsearch– are
+available to the API or if the problem is intrinsic to itself.
+
+## Historical false positives
+
+Nothing registered to date.
+
+## Related incident reports
+
+- _2023-07-16 at 05:05 UTC: 5XX responses spike to ~50 near a database restart
+ during the RDS maintenance window. Unknown cause._
diff --git a/documentation/meta/monitoring/runbooks/api_request_count_above_threshold.md b/documentation/meta/monitoring/runbooks/api_request_count_above_threshold.md
new file mode 100644
index 000000000..332c7afaf
--- /dev/null
+++ b/documentation/meta/monitoring/runbooks/api_request_count_above_threshold.md
@@ -0,0 +1,36 @@
+# Run Book: API Production Request Count above threshold
+
+```{admonition} Metadata
+Status: **Unstable**
+
+Maintainer: @krysaldb
+
+Alarm link:
+- <https://us-east-1.console.aws.amazon.com/cloudwatch/home?region=us-east-1#alarmsV2:alarm/API+Production+Request+Count+above+threshold?>
+```
+
+## Severity Guide
+
+When a sudden increase in request count is noticed, verify that the services are
+supporting the load by looking at metrics like response time or ES CPU usage for
+example. If the API is doing fine, then severity is low and may only require
+future resource scaling depending on the kind of traffic.
+
+If the services are strained then the severity is critical, search for the root
+cause to prevent more serious outages. If there are no recent obvious
+integrations (like the Gutenberg plugin) then follow the run book to [identify
+traffic anomalies in Cloudflare][runbook_traffic], to determine whether the
+recent traffic is organic or if it comes from a botnet. Find the origin of
+requests and evaluate whether it needs to be blocked or if Openverse services
+need to adapt to the new demand.
+
+[runbook_traffic]:
+ https://docs.openverse.org/meta/monitoring/traffic/runbooks/identifying-and-blocking-traffic-anomalies.html
+
+## Historical false positives
+
+Nothing registered to date.
+
+## Related incident reports
+
+Nothing registered to date.
diff --git a/documentation/meta/monitoring/runbooks/index.md b/documentation/meta/monitoring/runbooks/index.md
index e5a47f092..7bf179886 100644
--- a/documentation/meta/monitoring/runbooks/index.md
+++ b/documentation/meta/monitoring/runbooks/index.md
@@ -12,6 +12,9 @@ that can be a good resource when writing a new one.
```{toctree}
:titlesonly:
+api_request_count_above_threshold
+api_http_2xx_under_threshold
+api_http_5xx_above_threshold
unhealthy_ecs_hosts
nuxt_2xx_under_threshold
nuxt_5xx_above_threshold