@@ -6,7 +6,8 @@ commands:
6
6
# and 5s queries are present, as well as patroni metrics.
7
7
# Then, check the collector logs for patroni, pgbackrest, and postgres logs.
8
8
# Finally, ensure the monitoring user exists and is configured.
9
- - script : |
9
+ - timeout : 400
10
+ script : |
10
11
retry() { bash -ceu 'printf "$1\nSleeping...\n" && sleep 5' - "$@"; }
11
12
check_containers_ready() { bash -ceu 'echo "$1" | jq -e ".[] | select(.type==\"ContainersReady\") | .status==\"True\""' - "$@"; }
12
13
contains() { bash -ceu '[[ "$1" == *"$2"* ]]' - "$@"; }
@@ -22,21 +23,6 @@ commands:
22
23
exit 1
23
24
}
24
25
25
- scrape_metrics=$(kubectl exec "${pod}" -c collector -n "${NAMESPACE}" -- \
26
- curl --insecure --silent http://localhost:9187/metrics)
27
- { contains "${scrape_metrics}" 'ccp_connection_stats_active'; } || {
28
- retry "5 second metric not found"
29
- exit 1
30
- }
31
- { contains "${scrape_metrics}" 'ccp_database_size_bytes'; } || {
32
- retry "5 minute metric not found"
33
- exit 1
34
- }
35
- { contains "${scrape_metrics}" 'patroni_postgres_running'; } || {
36
- retry "patroni metric not found"
37
- exit 1
38
- }
39
-
40
26
logs=$(kubectl logs "${pod}" --namespace "${NAMESPACE}" -c collector | grep InstrumentationScope)
41
27
{ contains "${logs}" 'InstrumentationScope patroni'; } || {
42
28
retry "patroni logs not found"
@@ -51,6 +37,21 @@ commands:
51
37
exit 1
52
38
}
53
39
40
+ scrape_metrics=$(kubectl exec "${pod}" -c collector -n "${NAMESPACE}" -- \
41
+ curl --insecure --silent http://localhost:9187/metrics)
42
+ { contains "${scrape_metrics}" 'ccp_connection_stats_active'; } || {
43
+ retry "5 second metric not found"
44
+ exit 1
45
+ }
46
+ { contains "${scrape_metrics}" 'patroni_postgres_running'; } || {
47
+ retry "patroni metric not found"
48
+ exit 1
49
+ }
50
+ { contains "${scrape_metrics}" 'ccp_database_size_bytes'; } || {
51
+ retry "5 minute metric not found"
52
+ exit 1
53
+ }
54
+
54
55
kubectl exec --stdin "${pod}" --namespace "${NAMESPACE}" -c database \
55
56
-- psql -qb --set ON_ERROR_STOP=1 --file=- <<'SQL'
56
57
DO $$
0 commit comments