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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61203f2c5d53c61f05151255076c5004c65a254c2445d632ae8c7262ae0e1f82
4
- data.tar.gz: 66b13da650dd0e66b3a4d639bf1738de51474e047e0df878893a5b675d158827
3
+ metadata.gz: 871a04f90ba88d0584d1378778d84fa495e3d258824ca5af41c89eddcc7f6d68
4
+ data.tar.gz: d394f2f50050049ac4d1156ee6bfb79f5fcf422980989599afabf3eec4f2b210
5
5
  SHA512:
6
- metadata.gz: 7ab02d67cc6e2bf4e443e73f49138eb7549961d535a1c7425e7f9a7872ec7095f6ad77522105eee8111c674cbdebbfec304296953c884dd006832d452079414c
7
- data.tar.gz: 81bf3b39c8cb1462dabbf51be56057efb9fddfbe0db6da4d6f1f7827f71f4a8cebf04e5890caf07ccaa588b873897dfef32e91d7276361a6fe629349eb2691b0
6
+ metadata.gz: 8f2fa49fd5423c9fcf0d47512949b8ec93d95b2c1b48e48693fe1ad273af8053cdae42392b48740bc925e4d8e701254f815089a25f1311c9ecdba7e139e5d3f8
7
+ data.tar.gz: f9e8f5e8d42ba861bd297d0b0b9caae6b0729007ac3674fd637be7d091c8ca300cb0ff8cf6b084a07a7903e479381e2d58dceb770dfb829df585fd0d6395b6d8
@@ -1,13 +1,23 @@
1
- image: "ruby:2.3"
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
- 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
-
8
- cache:
9
- paths:
10
- - vendor
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:
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-exporter (6.1.0)
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.2)
23
+ pg (1.2.3)
24
24
  powerpack (0.1.1)
25
25
  quantile (0.2.1)
26
- rack (2.2.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.3)
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.7)
54
+ sidekiq (5.2.8)
55
55
  connection_pool (~> 2.2, >= 2.2.2)
56
- rack (>= 1.5.0)
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 (projects.visibility_level = 20 OR plans.name IN ('early_adopter', 'bronze', 'silver', 'gold'))
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 projects.namespace_id = namespaces.id
23
- LEFT JOIN plans ON namespaces.plan_id = plans.id
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: "ghost IS NULL AND bot_type IS NULL",
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
@@ -1,5 +1,5 @@
1
1
  module GitLab
2
2
  module Exporter
3
- VERSION = "6.1.0".freeze
3
+ VERSION = "7.0.4".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: 6.1.0
4
+ version: 7.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pablo Carranza