gitlab-exporter 13.0.3 → 13.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/gitlab_exporter/database/row_count.rb +56 -1
- data/lib/gitlab_exporter/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e25742f97cb40db0a84768e5b780c3d4d29af3c35ce456cc54ab5cebbf39ded7
|
4
|
+
data.tar.gz: 13cf4d4d86554c783d9c7cb1a7c9db42189b0fd6fe520e10f15b084cb5b43761
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f48b26649ec291a96b41976d6b674171667c43ab0f8de188809e9d22fdb3d0ee0d17c33ac1ef30a4f217f1f52c701335a88ed600a915797d8013a264359bdde
|
7
|
+
data.tar.gz: 954a83f62a78a78244503a2b47c5bfe9fc2fac338e46cf692d03731b53b459ec715e83b4bbd5df5320c55efe47c8e7db17b0af944fb490e09ee1b1453b4bf6a3
|
data/Gemfile.lock
CHANGED
@@ -8,7 +8,7 @@ module GitLab
|
|
8
8
|
# This class works under the assumption you do COUNT(*) queries, define
|
9
9
|
# queries in the QUERIES constant. If in doubt how these work, read
|
10
10
|
# #construct_query
|
11
|
-
class RowCountCollector < Base
|
11
|
+
class RowCountCollector < Base # rubocop:disable Metrics/ClassLength
|
12
12
|
# We ignore mirrors with a next_execution_timestamp before
|
13
13
|
# 2020-03-28 because this is when we stopped processing mirrors
|
14
14
|
# for private projects on the free plan. Skipping those can
|
@@ -29,6 +29,15 @@ module GitLab
|
|
29
29
|
check: "SELECT 1 FROM information_schema.tables WHERE table_name='plans'"
|
30
30
|
}.freeze
|
31
31
|
|
32
|
+
CONTAINER_REPOSITORIES_CLEANUP_ENABLED_QUERY = {
|
33
|
+
select: :container_repositories,
|
34
|
+
joins: <<~SQL,
|
35
|
+
INNER JOIN container_expiration_policies
|
36
|
+
ON container_repositories.project_id = container_expiration_policies.project_id
|
37
|
+
SQL
|
38
|
+
where: "container_expiration_policies.enabled = TRUE"
|
39
|
+
}.freeze
|
40
|
+
|
32
41
|
QUERIES = {
|
33
42
|
mirrors_ready_to_sync: MIRROR_QUERY.merge( # EE only
|
34
43
|
where: <<~SQL
|
@@ -117,6 +126,52 @@ module GitLab
|
|
117
126
|
visibility_level: {},
|
118
127
|
root: { definition: "(parent_id IS NULL)" }
|
119
128
|
}
|
129
|
+
},
|
130
|
+
container_repositories: { select: :container_repositories },
|
131
|
+
container_repositories_delete_scheduled: { select: :container_repositories, where: "status = 0" },
|
132
|
+
container_repositories_delete_failed: { select: :container_repositories, where: "status = 1" },
|
133
|
+
container_repositories_delete_ongoing: { select: :container_repositories, where: "status = 2" },
|
134
|
+
container_repositories_delete_staled: {
|
135
|
+
select: :container_repositories,
|
136
|
+
where: "status = 2 AND delete_started_at < (NOW() - INTERVAL '30 minutes')"
|
137
|
+
},
|
138
|
+
container_repositories_cleanup_enabled: CONTAINER_REPOSITORIES_CLEANUP_ENABLED_QUERY,
|
139
|
+
container_repositories_cleanup_pending: CONTAINER_REPOSITORIES_CLEANUP_ENABLED_QUERY.merge(
|
140
|
+
where: <<~SQL
|
141
|
+
container_expiration_policies.enabled = TRUE
|
142
|
+
AND container_repositories.expiration_policy_cleanup_status IN (0, 1)
|
143
|
+
AND (container_repositories.expiration_policy_started_at IS NULL OR container_repositories.expiration_policy_started_at < container_expiration_policies.next_run_at)
|
144
|
+
AND (container_expiration_policies.next_run_at < NOW())
|
145
|
+
SQL
|
146
|
+
),
|
147
|
+
container_repositories_cleanup_unfinished: CONTAINER_REPOSITORIES_CLEANUP_ENABLED_QUERY.merge(
|
148
|
+
where: <<~SQL
|
149
|
+
container_expiration_policies.enabled = TRUE
|
150
|
+
AND container_repositories.expiration_policy_cleanup_status = 2
|
151
|
+
SQL
|
152
|
+
),
|
153
|
+
container_repositories_cleanup_unscheduled: CONTAINER_REPOSITORIES_CLEANUP_ENABLED_QUERY.merge(
|
154
|
+
where: <<~SQL
|
155
|
+
container_expiration_policies.enabled = TRUE
|
156
|
+
AND container_repositories.expiration_policy_cleanup_status = 0
|
157
|
+
SQL
|
158
|
+
),
|
159
|
+
container_repositories_cleanup_scheduled: CONTAINER_REPOSITORIES_CLEANUP_ENABLED_QUERY.merge(
|
160
|
+
where: <<~SQL
|
161
|
+
container_expiration_policies.enabled = TRUE
|
162
|
+
AND container_repositories.expiration_policy_cleanup_status = 1
|
163
|
+
SQL
|
164
|
+
),
|
165
|
+
container_repositories_cleanup_ongoing: {
|
166
|
+
select: :container_repositories,
|
167
|
+
where: "expiration_policy_cleanup_status = 3"
|
168
|
+
},
|
169
|
+
container_repositories_cleanup_staled: {
|
170
|
+
select: :container_repositories,
|
171
|
+
where: <<~SQL
|
172
|
+
expiration_policy_cleanup_status = 3
|
173
|
+
AND (expiration_policy_started_at < (NOW() - INTERVAL '35 minutes') OR expiration_policy_started_at IS NULL)
|
174
|
+
SQL
|
120
175
|
}
|
121
176
|
}.freeze
|
122
177
|
|