Skip to content

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

Add runbooks for API response times alarms (#3001)

Krystle Salazarde7e1428faac
diff --git a/documentation/meta/monitoring/runbooks/api_avg_response_time_above_threshold.md b/documentation/meta/monitoring/runbooks/api_avg_response_time_above_threshold.md
new file mode 100644
index 000000000..35c7db8c0
--- /dev/null
+++ b/documentation/meta/monitoring/runbooks/api_avg_response_time_above_threshold.md
@@ -0,0 +1,38 @@
+# Run Book: API Production Average Response Time 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+Average+Response+Time+above+threshold?>
+```
+
+## Severity Guide
+
+To identify the source of the slowdown first check if there was a recent
+deployment that may have introduced the problem, in that case rollback to the
+previous version. Otherwise, check the following, in order:
+
+1. Request count and general network activity. If abnormally high, refer to the
+ [traffic analysis run book][traffic_runbook] to identify whether there is
+ malicious traffic. If not, move on.
+2. Check if dependencies like Elasticsearch or the database are constrained. If
+ stable, move on.
+3. Parse query parameters from Nginx logs and check pagination and parameter
+ count activity for abnormal or unexpected behaviour. If any exist, decide
+ whether it is malicious or expected.
+
+[traffic_runbook]:
+ /meta/monitoring/traffic/runbooks/identifying-and-blocking-traffic-anomalies.md
+
+## Historical false positives
+
+Nothing registered to date.
+
+## Related incident reports
+
+- 2023-09-01 at 18:10 UTC: Increased API response times over filtered image
+ index recreation
+- 2023-08-20 at 20:00 UTC: Increased API response times (reason unknown)
diff --git a/documentation/meta/monitoring/runbooks/api_avg_response_time_anomaly.md b/documentation/meta/monitoring/runbooks/api_avg_response_time_anomaly.md
new file mode 100644
index 000000000..1ed94fb1f
--- /dev/null
+++ b/documentation/meta/monitoring/runbooks/api_avg_response_time_anomaly.md
@@ -0,0 +1,37 @@
+# Run Book: API Production Average Response Time anomaly
+
+```{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+Average+Response+Time+anomalously+high?>
+```
+
+## Severity Guide
+
+To identify the source of the slowdown first check if there was a recent
+deployment that may have introduced the problem, in that case rollback to the
+previous version. Otherwise, check the following, in order:
+
+1. Request count and general network activity. If abnormally high, refer to the
+ [traffic analysis run book][traffic_runbook] to identify whether there is
+ malicious traffic. If not, move on.
+2. Check if dependencies like Elasticsearch or the database are constrained. If
+ stable, move on.
+3. Parse query parameters from Nginx logs and check pagination and parameter
+ count activity for abnormal or unexpected behaviour. If any exist, decide
+ whether it is malicious or expected.
+
+[traffic_runbook]:
+ /meta/monitoring/traffic/runbooks/identifying-and-blocking-traffic-anomalies.md
+
+## Historical false positives
+
+Nothing registered to date.
+
+## Related incident reports
+
+- 2023-09-01 at 18:10 UTC: Increased API response times over filtered image
+ index recreation
diff --git a/documentation/meta/monitoring/runbooks/api_p99_response_time_above_threshold.md b/documentation/meta/monitoring/runbooks/api_p99_response_time_above_threshold.md
new file mode 100644
index 000000000..2f99d15ed
--- /dev/null
+++ b/documentation/meta/monitoring/runbooks/api_p99_response_time_above_threshold.md
@@ -0,0 +1,38 @@
+# Run Book: API Production P99 Response Time 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+P99+Response+Time+above+threshold?>
+```
+
+## Severity Guide
+
+To identify the source of the slowdown first check if there was a recent
+deployment that may have introduced the problem, in that case rollback to the
+previous version. Otherwise, check the following, in order:
+
+1. Request count and general network activity. If abnormally high, refer to the
+ [traffic analysis run book][traffic_runbook] to identify whether there is
+ malicious traffic. If not, move on.
+2. Check if dependencies like Elasticsearch or the database are constrained. If
+ stable, move on.
+3. Parse query parameters from Nginx logs and check pagination and parameter
+ count activity for abnormal or unexpected behaviour. If any exist, decide
+ whether it is malicious or expected.
+
+[traffic_runbook]:
+ /meta/monitoring/traffic/runbooks/identifying-and-blocking-traffic-anomalies.md
+
+## Historical false positives
+
+Nothing registered to date.
+
+## Related incident reports
+
+- 2023-09-01 at 18:10 UTC: Increased API response times over filtered image
+ index recreation
+- 2023-08-20 at 20:00 UTC: Increased API response times (reason unknown)
diff --git a/documentation/meta/monitoring/runbooks/api_p99_response_time_anomaly.md b/documentation/meta/monitoring/runbooks/api_p99_response_time_anomaly.md
new file mode 100644
index 000000000..6ccb8ef98
--- /dev/null
+++ b/documentation/meta/monitoring/runbooks/api_p99_response_time_anomaly.md
@@ -0,0 +1,37 @@
+# Run Book: API Production P99 Response Time anomaly
+
+```{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+P99+Response+Time+anomalously+high?>
+```
+
+## Severity Guide
+
+To identify the source of the slowdown first check if there was a recent
+deployment that may have introduced the problem, in that case rollback to the
+previous version. Otherwise, check the following, in order:
+
+1. Request count and general network activity. If abnormally high, refer to the
+ [traffic analysis run book][traffic_runbook] to identify whether there is
+ malicious traffic. If not, move on.
+2. Check if dependencies like Elasticsearch or the database are constrained. If
+ stable, move on.
+3. Parse query parameters from Nginx logs and check pagination and parameter
+ count activity for abnormal or unexpected behaviour. If any exist, decide
+ whether it is malicious or expected.
+
+[traffic_runbook]:
+ /meta/monitoring/traffic/runbooks/identifying-and-blocking-traffic-anomalies.md
+
+## Historical false positives
+
+Nothing registered to date.
+
+## Related incident reports
+
+- 2023-09-01 at 18:10 UTC: Increased API response times over filtered image
+ index recreation
diff --git a/documentation/meta/monitoring/runbooks/index.md b/documentation/meta/monitoring/runbooks/index.md
index 7bf179886..4754b9345 100644
--- a/documentation/meta/monitoring/runbooks/index.md
+++ b/documentation/meta/monitoring/runbooks/index.md
@@ -12,11 +12,15 @@ 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
+api_request_count_above_threshold
+api_avg_response_time_above_threshold
+api_avg_response_time_anomaly
+api_p99_response_time_above_threshold
+api_p99_response_time_anomaly
nuxt_2xx_under_threshold
nuxt_5xx_above_threshold
nuxt_request_count
+unhealthy_ecs_hosts
```