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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 772759981296901f1bd6ed3d38a9f98cf882ddbc851605c8dfb31b47aceed046
4
- data.tar.gz: 82f8e5ce3795f3349dd1cd053161302cf01eafe0c57485ec3074e7a8844606a9
3
+ metadata.gz: e25742f97cb40db0a84768e5b780c3d4d29af3c35ce456cc54ab5cebbf39ded7
4
+ data.tar.gz: 13cf4d4d86554c783d9c7cb1a7c9db42189b0fd6fe520e10f15b084cb5b43761
5
5
  SHA512:
6
- metadata.gz: ed3d74142e8da3b4bf367c9bf26b91b1e55a42f904e494479797d1bc10f07324e0734247a271a44e1a6db6ca745dddaddf97688d0ba659ff3e27f3f927fa6973
7
- data.tar.gz: f0af44afc5e5c3d425bdfe09e1d846b550b53f9b1bc24cad7549715a8d18dc751f60dda5a8e7c934d1a0b6c2f0285ea533c64419deaab78087ef102c2161d40b
6
+ metadata.gz: 7f48b26649ec291a96b41976d6b674171667c43ab0f8de188809e9d22fdb3d0ee0d17c33ac1ef30a4f217f1f52c701335a88ed600a915797d8013a264359bdde
7
+ data.tar.gz: 954a83f62a78a78244503a2b47c5bfe9fc2fac338e46cf692d03731b53b459ec715e83b4bbd5df5320c55efe47c8e7db17b0af944fb490e09ee1b1453b4bf6a3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-exporter (13.0.3)
4
+ gitlab-exporter (13.1.0)
5
5
  connection_pool (= 2.2.5)
6
6
  faraday (~> 1.8.0)
7
7
  pg (= 1.5.3)
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  module GitLab
2
2
  module Exporter
3
- VERSION = "13.0.3".freeze
3
+ VERSION = "13.1.0".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-exporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.0.3
4
+ version: 13.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pablo Carranza