gitlab-exporter 6.1.0 → 7.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +19 -9
- data/Gemfile.lock +6 -6
- data/lib/gitlab_exporter/database/row_count.rb +24 -4
- 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: 871a04f90ba88d0584d1378778d84fa495e3d258824ca5af41c89eddcc7f6d68
|
4
|
+
data.tar.gz: d394f2f50050049ac4d1156ee6bfb79f5fcf422980989599afabf3eec4f2b210
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f2fa49fd5423c9fcf0d47512949b8ec93d95b2c1b48e48693fe1ad273af8053cdae42392b48740bc925e4d8e701254f815089a25f1311c9ecdba7e139e5d3f8
|
7
|
+
data.tar.gz: f9e8f5e8d42ba861bd297d0b0b9caae6b0729007ac3674fd637be7d091c8ca300cb0ff8cf6b084a07a7903e479381e2d58dceb770dfb829df585fd0d6395b6d8
|
data/.gitlab-ci.yml
CHANGED
@@ -1,13 +1,23 @@
|
|
1
|
-
|
1
|
+
default:
|
2
|
+
image: "ruby:2.3"
|
3
|
+
before_script:
|
4
|
+
- git config --global user.email "bot@gitlab.com"
|
5
|
+
- git config --global user.name "Bot User"
|
6
|
+
- bundle install -j $(nproc) --path vendor
|
7
|
+
cache:
|
8
|
+
paths:
|
9
|
+
- vendor
|
10
|
+
tags:
|
11
|
+
- gitlab-org
|
2
12
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
-
|
13
|
+
workflow:
|
14
|
+
rules:
|
15
|
+
# For merge requests, create a pipeline.
|
16
|
+
- if: '$CI_MERGE_REQUEST_IID'
|
17
|
+
# For `master` branch, create a pipeline (this includes on schedules, pushes, merges, etc.).
|
18
|
+
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
19
|
+
# For tags, create a pipeline.
|
20
|
+
- if: '$CI_COMMIT_TAG'
|
11
21
|
|
12
22
|
rspec:
|
13
23
|
script:
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gitlab-exporter (
|
4
|
+
gitlab-exporter (7.0.4)
|
5
5
|
connection_pool (~> 2.2.1)
|
6
6
|
pg (~> 1.1)
|
7
7
|
quantile (~> 0.2.0)
|
@@ -20,14 +20,14 @@ GEM
|
|
20
20
|
ruby2_keywords (~> 0.0.1)
|
21
21
|
parser (2.5.1.0)
|
22
22
|
ast (~> 2.4.0)
|
23
|
-
pg (1.2.
|
23
|
+
pg (1.2.3)
|
24
24
|
powerpack (0.1.1)
|
25
25
|
quantile (0.2.1)
|
26
|
-
rack (2.
|
26
|
+
rack (2.0.9)
|
27
27
|
rack-protection (2.0.8.1)
|
28
28
|
rack
|
29
29
|
rainbow (2.1.0)
|
30
|
-
redis (4.1.
|
30
|
+
redis (4.1.4)
|
31
31
|
redis-namespace (1.6.0)
|
32
32
|
redis (>= 3.0.4)
|
33
33
|
rspec (3.7.0)
|
@@ -51,9 +51,9 @@ GEM
|
|
51
51
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
52
52
|
ruby-progressbar (1.8.1)
|
53
53
|
ruby2_keywords (0.0.2)
|
54
|
-
sidekiq (5.2.
|
54
|
+
sidekiq (5.2.8)
|
55
55
|
connection_pool (~> 2.2, >= 2.2.2)
|
56
|
-
rack (
|
56
|
+
rack (< 2.1.0)
|
57
57
|
rack-protection (>= 1.5.0)
|
58
58
|
redis (>= 3.3.5, < 5)
|
59
59
|
sinatra (2.0.8.1)
|
@@ -8,19 +8,38 @@ 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
|
+
# rubocop:disable Metrics/ClassLength
|
11
12
|
class RowCountCollector < Base
|
13
|
+
# We ignore mirrors with a next_execution_timestamp before
|
14
|
+
# 2020-03-28 because this is when we stopped processing mirrors
|
15
|
+
# for private projects on the free plan. Skipping those can
|
16
|
+
# significantly improve query performance:
|
17
|
+
# https://gitlab.com/gitlab-org/gitlab/-/issues/216252#note_334514544
|
12
18
|
WHERE_MIRROR_ENABLED = <<~SQL.freeze
|
13
19
|
projects.mirror = true
|
20
|
+
AND projects.archived = false
|
14
21
|
AND project_mirror_data.retry_count <= 14
|
15
|
-
AND (
|
22
|
+
AND (
|
23
|
+
(projects.visibility_level = 20 AND root_namespaces.visibility_level = 20)
|
24
|
+
OR
|
25
|
+
plans.name IN ('early_adopter', 'bronze', 'silver', 'gold')
|
26
|
+
)
|
27
|
+
AND project_mirror_data.next_execution_timestamp > '2020-03-28'
|
16
28
|
SQL
|
17
29
|
|
18
30
|
MIRROR_QUERY = {
|
19
31
|
select: :projects,
|
20
32
|
joins: <<~SQL,
|
21
33
|
INNER JOIN project_mirror_data ON project_mirror_data.project_id = projects.id
|
22
|
-
INNER JOIN namespaces ON
|
23
|
-
|
34
|
+
INNER JOIN namespaces AS root_namespaces ON root_namespaces.id = (
|
35
|
+
WITH RECURSIVE "base_and_ancestors" AS (
|
36
|
+
(SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."id" = projects.namespace_id)
|
37
|
+
UNION
|
38
|
+
(SELECT "namespaces".* FROM "namespaces", "base_and_ancestors" WHERE "namespaces"."id" = "base_and_ancestors"."parent_id")
|
39
|
+
) SELECT "namespaces".id FROM "base_and_ancestors" AS "namespaces" WHERE "namespaces"."parent_id" IS NULL
|
40
|
+
)
|
41
|
+
LEFT JOIN gitlab_subscriptions ON gitlab_subscriptions.namespace_id = root_namespaces.id
|
42
|
+
LEFT JOIN plans ON plans.id = gitlab_subscriptions.hosted_plan_id
|
24
43
|
SQL
|
25
44
|
check: "SELECT 1 FROM information_schema.tables WHERE table_name='plans'"
|
26
45
|
}.freeze
|
@@ -91,7 +110,7 @@ module GitLab
|
|
91
110
|
GROUP BY members.user_id
|
92
111
|
) AS u
|
93
112
|
ON users.id = u.user_id",
|
94
|
-
where: "
|
113
|
+
where: "user_type IS NULL",
|
95
114
|
fields: {
|
96
115
|
admin: {},
|
97
116
|
external: {},
|
@@ -189,6 +208,7 @@ module GitLab
|
|
189
208
|
query_string << ";"
|
190
209
|
end
|
191
210
|
end
|
211
|
+
# rubocop:enable Metrics/ClassLength
|
192
212
|
|
193
213
|
# The prober which is called when gathering metrics
|
194
214
|
class RowCountProber
|