gitlab-exporter 15.6.0 → 16.1.0

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: be5eae9de48805398cb677af26e8b81df7435975413610d772873982e9169ca0
4
- data.tar.gz: 56d752f6f03d1624ac336d98565a198b7eee29a237b38e11c920aceda4eee7e4
3
+ metadata.gz: f8f9e18ad6f1758709b718bb67c3491f654a01078aa7835462a0e346731adff9
4
+ data.tar.gz: affa763080262ed9621f7d51f8342aaebb2ca8cd5f6296b730a02a042d62b816
5
5
  SHA512:
6
- metadata.gz: '08ce3e0e1a87ff46fc48e69ec458ae795a2ed2e117c4ccdc05c4fd036051d56e73bc8edd9ae270e7a52b9fa012c5c8f343595ffd1a8da55e3dfa468b9d4f1127'
7
- data.tar.gz: ab467b4ae68d9a8b3bc5ea7a68d0130378b5859cee0160079aff9aac7f3bb6e48b609d213d558965c0badffcedddc3b8926921c059f765263a5d6ef23ab8132a
6
+ metadata.gz: 7148d67304d3605314d65ce4c33a4450f33853a086da26150ee19532353db76d05d43326de068894f5d88ee879496ead866917ca2753e37623affab5e9b02292
7
+ data.tar.gz: 8d677307d6a128a01c695ce1cec716f31673032ad744bb600a89e713e9ae32ffa39e93ab22790d4e09fca6f485c1664e000ddf627d1bab31ad49e18d5e6f3891
data/.gitlab-ci.yml CHANGED
@@ -7,7 +7,7 @@ include:
7
7
  - template: Security/Dependency-Scanning.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab-foss/blob/master/lib/gitlab/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml
8
8
 
9
9
  variables:
10
- RUBY_VERSION: "2.7"
10
+ RUBY_VERSION: "3.3"
11
11
 
12
12
  stages:
13
13
  - test
@@ -17,6 +17,7 @@ stages:
17
17
  default:
18
18
  image: ruby:${RUBY_VERSION}
19
19
  cache:
20
+ key: ruby-${RUBY_VERSION}
20
21
  paths:
21
22
  - vendor
22
23
  tags:
@@ -26,6 +27,15 @@ default:
26
27
  - git config --global user.email "bot@gitlab.com"
27
28
  - git config --global user.name "Bot User"
28
29
  - bundle config set --local deployment true
30
+ - |
31
+ # Bundler 2.7.1 and up require Ruby 3.2 and up, so
32
+ # to avoid https://github.com/rubygems/rubygems/issues/5380 use an
33
+ # older Bundler version.
34
+ case ${RUBY_VERSION} in
35
+ "3.0"|"3.1")
36
+ export BUNDLER_VERSION="2.4.20"
37
+ ;;
38
+ esac
29
39
  - bundle install -j $(nproc)
30
40
 
31
41
  workflow:
@@ -43,7 +53,7 @@ rspec:
43
53
  before_script: *before_scripts
44
54
  parallel:
45
55
  matrix:
46
- - RUBY_VERSION: ["2.7", "3.0", "3.1", "3.2"]
56
+ - RUBY_VERSION: ["3.0", "3.1", "3.2", "3.3", "3.4"]
47
57
 
48
58
  rspec_integration:
49
59
  script:
@@ -78,7 +88,7 @@ rspec_integration:
78
88
  REDIS_SENTINEL_PASSWORD: "my-sentinel-password"
79
89
  parallel:
80
90
  matrix:
81
- - RUBY_VERSION: ["2.7", "3.0", "3.1", "3.2"]
91
+ - RUBY_VERSION: ["3.0", "3.1", "3.2", "3.3", "3.4"]
82
92
 
83
93
  rubocop:
84
94
  script:
data/.rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.7
4
+ TargetRubyVersion: 3.0
5
5
  DisplayCopNames: true
6
6
 
7
7
  # Just use double quotes please
data/.rubocop_todo.yml CHANGED
@@ -1,19 +1,14 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2021-01-11 12:24:03 UTC using RuboCop version 0.93.1.
3
+ # on 2025-08-06 20:59:18 UTC using RuboCop version 1.79.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 1
10
- # Configuration parameters: Include.
11
- # Include: **/*.gemspec
12
- Gemspec/RequiredRubyVersion:
13
- Exclude:
14
- - 'gitlab-exporter.gemspec'
15
-
16
9
  # Offense count: 3
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
17
12
  Lint/AmbiguousBlockAssociation:
18
13
  Exclude:
19
14
  - 'spec/git_spec.rb'
@@ -26,38 +21,32 @@ Lint/MissingCopEnableDirective:
26
21
  - 'spec/database/ci_builds_spec.rb'
27
22
  - 'spec/git_process_proper_spec.rb'
28
23
 
29
- # Offense count: 1
30
- # Cop supports --auto-correct.
31
- Lint/NonDeterministicRequireOrder:
32
- Exclude:
33
- - 'spec/spec_helper.rb'
34
-
35
- # Offense count: 16
36
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
37
- # ExcludedMethods: refine
24
+ # Offense count: 24
25
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
26
+ # AllowedMethods: refine
38
27
  Metrics/BlockLength:
39
- Max: 349
28
+ Max: 297
40
29
 
41
- # Offense count: 1
42
- # Configuration parameters: IgnoredMethods.
30
+ # Offense count: 2
31
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
43
32
  Metrics/CyclomaticComplexity:
44
33
  Max: 8
45
34
 
46
35
  # Offense count: 1
47
- # Configuration parameters: IgnoredMethods.
36
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
48
37
  Metrics/PerceivedComplexity:
49
38
  Max: 9
50
39
 
51
40
  # Offense count: 1
52
- # Configuration parameters: EnforcedStyle, AllowModifiersOnSymbols.
53
- # SupportedStyles: inline, group
54
- Style/AccessModifierDeclarations:
41
+ # Configuration parameters: AllowedMethods.
42
+ # AllowedMethods: respond_to_missing?
43
+ Style/OptionalBooleanParameter:
55
44
  Exclude:
56
- - 'lib/gitlab_exporter/util.rb'
45
+ - 'lib/gitlab_exporter/prometheus.rb'
57
46
 
58
- # Offense count: 2
59
- # Cop supports --auto-correct.
60
- # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
47
+ # Offense count: 3
48
+ # This cop supports unsafe autocorrection (--autocorrect-all).
49
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
61
50
  # AllowedMethods: present?, blank?, presence, try, try!
62
51
  Style/SafeNavigation:
63
52
  Exclude:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.7
1
+ 3.0.7
data/Gemfile CHANGED
@@ -3,6 +3,5 @@ source "https://rubygems.org"
3
3
  gemspec
4
4
 
5
5
  group :test do
6
- gem "rspec", "~>3.12"
7
- gem "rubocop", "~>0.42"
6
+ gem "rubocop", "~>1.0"
8
7
  end
data/Gemfile.lock CHANGED
@@ -1,51 +1,58 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-exporter (15.6.0)
5
- connection_pool (= 2.2.5)
4
+ gitlab-exporter (16.1.0)
5
+ connection_pool (= 2.5.3)
6
6
  deep_merge (~> 1.2.2)
7
- faraday (>= 1.8.0, <= 2.8.1)
8
- pg (= 1.5.9)
9
- puma (= 5.6.8)
7
+ faraday (= 2.13.4)
8
+ pg (= 1.6.1)
9
+ puma (= 6.6.1)
10
10
  quantile (= 0.2.1)
11
- redis (= 4.5.0)
12
- redis-namespace (= 1.9.0)
11
+ redis (= 4.8.1)
12
+ redis-namespace (= 1.11.0)
13
13
  sidekiq (= 6.5.12)
14
- sinatra (~> 2.2.0)
15
- webrick (~> 1.7)
14
+ sinatra (~> 3.2.0)
15
+ webrick (~> 1.9)
16
16
 
17
17
  GEM
18
18
  remote: https://rubygems.org/
19
19
  specs:
20
- ast (2.4.1)
20
+ ast (2.4.3)
21
21
  base64 (0.2.0)
22
- connection_pool (2.2.5)
22
+ connection_pool (2.5.3)
23
23
  deep_merge (1.2.2)
24
24
  diff-lcs (1.5.0)
25
- faraday (2.8.1)
26
- base64
27
- faraday-net_http (>= 2.0, < 3.1)
28
- ruby2_keywords (>= 0.0.4)
25
+ faraday (2.13.4)
26
+ faraday-net_http (>= 2.0, < 3.5)
27
+ json
28
+ logger
29
29
  faraday-net_http (3.0.2)
30
- mustermann (2.0.2)
30
+ json (2.13.2)
31
+ language_server-protocol (3.17.0.5)
32
+ lint_roller (1.1.0)
33
+ logger (1.7.0)
34
+ mustermann (3.0.3)
31
35
  ruby2_keywords (~> 0.0.1)
32
36
  nio4r (2.7.4)
33
- parallel (1.20.1)
34
- parser (3.0.0.0)
37
+ parallel (1.27.0)
38
+ parser (3.3.9.0)
35
39
  ast (~> 2.4.1)
36
- pg (1.5.9)
37
- puma (5.6.8)
40
+ racc
41
+ pg (1.6.1)
42
+ prism (1.4.0)
43
+ puma (6.6.1)
38
44
  nio4r (~> 2.0)
39
45
  quantile (0.2.1)
46
+ racc (1.8.1)
40
47
  rack (2.2.15)
41
- rack-protection (2.2.4)
42
- rack
43
- rainbow (3.0.0)
44
- redis (4.5.0)
45
- redis-namespace (1.9.0)
48
+ rack-protection (3.2.0)
49
+ base64 (>= 0.1.0)
50
+ rack (~> 2.2, >= 2.2.4)
51
+ rainbow (3.1.1)
52
+ redis (4.8.1)
53
+ redis-namespace (1.11.0)
46
54
  redis (>= 4)
47
- regexp_parser (2.0.3)
48
- rexml (3.2.4)
55
+ regexp_parser (2.11.0)
49
56
  rspec (3.12.0)
50
57
  rspec-core (~> 3.12.0)
51
58
  rspec-expectations (~> 3.12.0)
@@ -59,30 +66,35 @@ GEM
59
66
  diff-lcs (>= 1.2.0, < 2.0)
60
67
  rspec-support (~> 3.12.0)
61
68
  rspec-support (3.12.0)
62
- rubocop (0.93.1)
69
+ rubocop (1.79.1)
70
+ json (~> 2.3)
71
+ language_server-protocol (~> 3.17.0.2)
72
+ lint_roller (~> 1.1.0)
63
73
  parallel (~> 1.10)
64
- parser (>= 2.7.1.5)
74
+ parser (>= 3.3.0.2)
65
75
  rainbow (>= 2.2.2, < 4.0)
66
- regexp_parser (>= 1.8)
67
- rexml
68
- rubocop-ast (>= 0.6.0)
76
+ regexp_parser (>= 2.9.3, < 3.0)
77
+ rubocop-ast (>= 1.46.0, < 2.0)
69
78
  ruby-progressbar (~> 1.7)
70
- unicode-display_width (>= 1.4.0, < 2.0)
71
- rubocop-ast (1.4.0)
72
- parser (>= 2.7.1.5)
73
- ruby-progressbar (1.11.0)
79
+ unicode-display_width (>= 2.4.0, < 4.0)
80
+ rubocop-ast (1.46.0)
81
+ parser (>= 3.3.7.2)
82
+ prism (~> 1.4)
83
+ ruby-progressbar (1.13.0)
74
84
  ruby2_keywords (0.0.5)
75
85
  sidekiq (6.5.12)
76
86
  connection_pool (>= 2.2.5, < 3)
77
87
  rack (~> 2.0)
78
88
  redis (>= 4.5.0, < 5)
79
- sinatra (2.2.4)
80
- mustermann (~> 2.0)
81
- rack (~> 2.2)
82
- rack-protection (= 2.2.4)
89
+ sinatra (3.2.0)
90
+ mustermann (~> 3.0)
91
+ rack (~> 2.2, >= 2.2.4)
92
+ rack-protection (= 3.2.0)
83
93
  tilt (~> 2.0)
84
94
  tilt (2.6.0)
85
- unicode-display_width (1.7.0)
95
+ unicode-display_width (3.1.4)
96
+ unicode-emoji (~> 4.0, >= 4.0.4)
97
+ unicode-emoji (4.0.4)
86
98
  webrick (1.9.1)
87
99
 
88
100
  PLATFORMS
@@ -90,9 +102,9 @@ PLATFORMS
90
102
 
91
103
  DEPENDENCIES
92
104
  gitlab-exporter!
93
- rspec (~> 3.12)
105
+ rspec (~> 3.12.0)
94
106
  rspec-expectations (~> 3.12.0)
95
- rubocop (~> 0.42)
107
+ rubocop (~> 1.0)
96
108
 
97
109
  BUNDLED WITH
98
- 2.4.20
110
+ 2.7.1
@@ -20,19 +20,19 @@ Gem::Specification.new do |s|
20
20
  s.homepage = "https://gitlab.com/gitlab-org/ruby/gems/gitlab-exporter"
21
21
  s.license = "MIT"
22
22
 
23
- s.add_runtime_dependency "connection_pool", "2.2.5"
23
+ s.required_ruby_version = Gem::Requirement.new(">= 3.0")
24
+
25
+ s.add_runtime_dependency "connection_pool", "2.5.3"
24
26
  s.add_runtime_dependency "deep_merge", "~> 1.2.2"
25
- # Lock to 2.8.1 until RubyGems 3.5.5 is shipped with the fix for
26
- # https://github.com/rubygems/rubygems/issues/7374
27
- s.add_runtime_dependency "faraday", [">= 1.8.0", "<= 2.8.1"]
28
- s.add_runtime_dependency "pg", "1.5.9"
29
- s.add_runtime_dependency "puma", "5.6.8"
27
+ s.add_runtime_dependency "faraday", "2.13.4"
28
+ s.add_runtime_dependency "pg", "1.6.1"
29
+ s.add_runtime_dependency "puma", "6.6.1"
30
30
  s.add_runtime_dependency "quantile", "0.2.1"
31
- s.add_runtime_dependency "redis", "4.5.0"
32
- s.add_runtime_dependency "redis-namespace", "1.9.0"
31
+ s.add_runtime_dependency "redis", "4.8.1"
32
+ s.add_runtime_dependency "redis-namespace", "1.11.0"
33
33
  s.add_runtime_dependency "sidekiq", "6.5.12"
34
- s.add_runtime_dependency "sinatra", "~> 2.2.0"
35
- s.add_runtime_dependency "webrick", "~> 1.7"
34
+ s.add_runtime_dependency "sinatra", "~> 3.2.0"
35
+ s.add_runtime_dependency "webrick", "~> 1.9"
36
36
 
37
37
  s.add_development_dependency "rspec", "~> 3.12.0"
38
38
  s.add_development_dependency "rspec-expectations", "~> 3.12.0"
@@ -2,20 +2,6 @@ require "yaml"
2
2
  require "deep_merge"
3
3
  require "English"
4
4
 
5
- # TODO: Remove this once we're on Ruby 3
6
- # https://gitlab.com/gitlab-org/gitlab/-/issues/393651
7
- unless YAML.respond_to?(:safe_load_file)
8
- module YAML # rubocop:disable Style/Documentation
9
- # Temporary Ruby 2 back-compat workaround.
10
- #
11
- # This method only exists as of stdlib 3.0.0:
12
- # https://ruby-doc.org/stdlib-3.0.0/libdoc/psych/rdoc/Psych.html
13
- def self.safe_load_file(path, **options)
14
- YAML.safe_load(File.read(path), **options)
15
- end
16
- end
17
- end
18
-
19
5
  module GitLab
20
6
  module Exporter
21
7
  # Stores runner classes in a single place
@@ -58,7 +44,7 @@ module GitLab
58
44
  @options = options(args)
59
45
  args = @options.parse!
60
46
  @source = args.shift
61
- @target = args.shift || STDOUT
47
+ @target = args.shift || $stdout
62
48
  @labels ||= {}
63
49
  end
64
50
 
@@ -93,7 +79,7 @@ module GitLab
93
79
 
94
80
  # Database tuple stats runner.
95
81
  #
96
- # It will take a database connection string and print results to STDOUT
82
+ # It will take a database connection string and print results to $stdout
97
83
  class DatabaseTupleStats
98
84
  COMMAND_NAME = "db-tuple-stats".freeze
99
85
 
@@ -101,7 +87,7 @@ module GitLab
101
87
  @options = options(args)
102
88
  @options.parse!
103
89
 
104
- @target = args.shift || STDOUT
90
+ @target = args.shift || $stdout
105
91
  @target = File.open(@target, "a") if @target.is_a?(String)
106
92
  end
107
93
 
@@ -135,7 +121,7 @@ module GitLab
135
121
 
136
122
  # Database row counts query runner.
137
123
  #
138
- # This will take the database connection and print the result to STDOUT
124
+ # This will take the database connection and print the result to $stdout
139
125
  class DatabaseRowCounts
140
126
  COMMAND_NAME = "row-counts".freeze
141
127
 
@@ -143,7 +129,7 @@ module GitLab
143
129
  @options = options(args)
144
130
  @options.parse!
145
131
 
146
- @target = args.shift || STDOUT
132
+ @target = args.shift || $stdout
147
133
  @target = File.open(@target, "a") if @target.is_a?(String)
148
134
  end
149
135
 
@@ -248,7 +234,7 @@ module GitLab
248
234
  @options = options(args)
249
235
  @options.parse!
250
236
 
251
- @target = args.shift || STDOUT
237
+ @target = args.shift || $stdout
252
238
  @target = File.open(@target, "a") if @target.is_a?(String)
253
239
  end
254
240
 
@@ -285,7 +271,7 @@ module GitLab
285
271
 
286
272
  # Sidekiq runner.
287
273
  #
288
- # It will take a Redis connection URL and print results to STDOUT
274
+ # It will take a Redis connection URL and print results to $stdout
289
275
  class SidekiqRunner
290
276
  COMMAND_NAME = "sidekiq".freeze
291
277
 
@@ -293,7 +279,7 @@ module GitLab
293
279
  @options = options(args)
294
280
  @options.parse!
295
281
 
296
- @target = args.shift || STDOUT
282
+ @target = args.shift || $stdout
297
283
  @target = File.open(@target, "a") if @target.is_a?(String)
298
284
  end
299
285
 
@@ -329,7 +315,7 @@ module GitLab
329
315
  redis_sentinels: @redis_sentinels,
330
316
  redis_sentinel_username: @redis_sentinel_username,
331
317
  redis_sentinel_password: @redis_sentinel_password,
332
- logger: Logger.new(STDERR))
318
+ logger: Logger.new($stderr))
333
319
 
334
320
  prober
335
321
  .probe_stats
@@ -357,7 +343,7 @@ module GitLab
357
343
  @options = options(args)
358
344
  @options.parse!
359
345
 
360
- @target = args.shift || STDOUT
346
+ @target = args.shift || $stdout
361
347
  @target = File.open(@target, "a") if @target.is_a?(String)
362
348
  end
363
349
 
@@ -191,7 +191,7 @@ module GitLab
191
191
  results = []
192
192
 
193
193
  query = ee? ? BUILDS_QUERY_EE : BUILDS_QUERY_CE
194
- query = query % [status] # rubocop:disable Style/FormatString
194
+ query %= [status]
195
195
  exec_query_with_custom_random_page_cost(query).each do |row|
196
196
  results << transform_builds_row_to_values(row)
197
197
  end
@@ -202,7 +202,7 @@ module GitLab
202
202
 
203
203
  result.map do |row|
204
204
  labels = {}
205
- (query_hash[:fields] || []).each do |key, _| labels[key] = row[key.to_s] end
205
+ (query_hash[:fields] || {}).each_key do |key| labels[key] = row[key.to_s] end
206
206
  { "count": row["count"], "labels": labels }
207
207
  end
208
208
  end
@@ -233,7 +233,7 @@ module GitLab
233
233
  query_string << " FROM #{query[:select]}"
234
234
  query_string << " #{query[:joins]}" if query[:joins]
235
235
  query_string << " WHERE #{query[:where]}" if query[:where]
236
- query_string << " GROUP BY " + query[:fields].keys.join(", ") if query[:fields]
236
+ query_string << " GROUP BY #{query[:fields].keys.join(', ')}" if query[:fields]
237
237
  query_string << ";"
238
238
  end
239
239
  end
@@ -5,30 +5,30 @@ module GitLab
5
5
  class ZoektCollector < Base
6
6
  QUERY = <<~SQL.freeze
7
7
  WITH task_counts AS (
8
- SELECT
8
+ SELECT
9
9
  zoekt_node_id,
10
10
  COUNT(*) AS count
11
- FROM
11
+ FROM
12
12
  zoekt_tasks
13
- WHERE
13
+ WHERE
14
14
  perform_at <= $1
15
15
  AND state IN (0, 1)
16
- GROUP BY
16
+ GROUP BY
17
17
  zoekt_node_id
18
18
  )
19
- SELECT
19
+ SELECT
20
20
  n.id AS node_id,
21
21
  n.metadata ->> 'name' AS node_name,
22
22
  COALESCE(tc.count, 0) AS task_count
23
- FROM
23
+ FROM
24
24
  zoekt_nodes n
25
- LEFT JOIN
25
+ LEFT JOIN
26
26
  task_counts tc ON n.id = tc.zoekt_node_id
27
27
  SQL
28
28
 
29
29
  ZOEKT_ENABLED_QUERY = <<~SQL.freeze
30
30
  SELECT
31
- zoekt_settings ->> 'zoekt_indexing_enabled' AS zoekt_indexing_enabled
31
+ zoekt_settings ->> 'zoekt_indexing_enabled' AS zoekt_indexing_enabled
32
32
  FROM application_settings
33
33
  ORDER BY ID DESC
34
34
  LIMIT 1
@@ -101,10 +101,10 @@ module GitLab
101
101
 
102
102
  Utils.pgrep("^git ").each do |pid|
103
103
  process_cmd = begin
104
- File.read("/proc/#{pid}/cmdline")
105
- rescue StandardError
106
- "" # Process file is gone (race condition)
107
- end
104
+ File.read("/proc/#{pid}/cmdline")
105
+ rescue StandardError
106
+ "" # Process file is gone (race condition)
107
+ end
108
108
  subcommand = self.class.extract_subcommand(process_cmd)
109
109
  next unless subcommand # Unlikely, but just to be safe
110
110
 
@@ -142,7 +142,7 @@ module GitLab
142
142
 
143
143
  cmd_splitted.shift # Because it's "git"
144
144
  cmd_splitted.shift while cmd_splitted.first &&
145
- (cmd_splitted.first.empty? || cmd_splitted.first !~ /^[^-][a-z\-]*$/)
145
+ (cmd_splitted.first.empty? || cmd_splitted.first !~ /^[^-][a-z-]*$/)
146
146
 
147
147
  cmd_splitted[0]
148
148
  end
@@ -27,23 +27,9 @@ module GitLab
27
27
  class Mapping
28
28
  FIELDS = %w[size rss shared_clean shared_dirty private_clean private_dirty swap pss].freeze
29
29
 
30
- attr_reader :address_start
31
- attr_reader :address_end
32
- attr_reader :perms
33
- attr_reader :offset
34
- attr_reader :device_major
35
- attr_reader :device_minor
36
- attr_reader :inode
37
- attr_reader :region
30
+ attr_reader :address_start, :address_end, :perms, :offset, :device_major, :device_minor, :inode, :region
38
31
 
39
- attr_accessor :size
40
- attr_accessor :rss
41
- attr_accessor :shared_clean
42
- attr_accessor :shared_dirty
43
- attr_accessor :private_dirty
44
- attr_accessor :private_clean
45
- attr_accessor :swap
46
- attr_accessor :pss
32
+ attr_accessor :size, :rss, :shared_clean, :shared_dirty, :private_dirty, :private_clean, :swap, :pss
47
33
 
48
34
  def initialize(lines)
49
35
  FIELDS.each do |field|
@@ -11,7 +11,7 @@ module GitLab
11
11
  end
12
12
 
13
13
  def probe_all
14
- @prober_opts.each do |_probe_name, params|
14
+ @prober_opts.each_value do |params|
15
15
  Utils.wrap_in_array(params[:opts]).each do |opts|
16
16
  prober = params[:class].new(metrics: @metrics, logger: @logger, **opts)
17
17
  params[:methods].each do |meth|
@@ -1,6 +1,6 @@
1
1
  # Contains helper methods to generate TLS related configuration for web servers
2
2
  module TLSHelper
3
- CERT_REGEX = /-----BEGIN CERTIFICATE-----(?:.|\n)+?-----END CERTIFICATE-----/.freeze
3
+ CERT_REGEX = /-----BEGIN CERTIFICATE-----(?:.|\n)+?-----END CERTIFICATE-----/
4
4
 
5
5
  def validate_tls_config(config)
6
6
  %i[tls_cert_path tls_key_path].each do |key|
@@ -1,5 +1,5 @@
1
1
  module GitLab
2
2
  module Exporter
3
- VERSION = "15.6.0".freeze
3
+ VERSION = "16.1.0".freeze
4
4
  end
5
5
  end
@@ -43,10 +43,10 @@ describe GitLab::Exporter::Database::BloatProber do
43
43
  end
44
44
 
45
45
  describe "#probe_db" do
46
- subject { described_class.new(metrics: metrics, collector: collector, logger: STDOUT, **opts).probe_db }
46
+ subject { described_class.new(metrics: metrics, collector: collector, logger: $stdout, **opts).probe_db }
47
47
 
48
48
  before do
49
- expect(collector).to receive(:logger=).with(STDOUT)
49
+ expect(collector).to receive(:logger=).with($stdout)
50
50
  end
51
51
 
52
52
  it "invokes the collector for each bloat type" do
@@ -3,9 +3,9 @@ require "gitlab_exporter/database/row_count"
3
3
 
4
4
  describe GitLab::Exporter::Database::RowCountCollector do
5
5
  let(:query) {
6
- { project_1: { select: :projects, where: "id=1" },
7
- project_2: { select: :projects, where: "id=2" },
8
- project_3: { select: :projects, fields: { is_public: { definition: "visibility_level == 20" } } } }
6
+ { project1: { select: :projects, where: "id=1" },
7
+ project2: { select: :projects, where: "id=2" },
8
+ project3: { select: :projects, fields: { is_public: { definition: "visibility_level == 20" } } } }
9
9
  }
10
10
  let(:collector) { described_class.new(connection_string: "host=localhost") }
11
11
 
@@ -26,29 +26,29 @@ describe GitLab::Exporter::Database::RowCountCollector do
26
26
 
27
27
  it "executes all the queries" do
28
28
  expect(collector.run).to eq(
29
- project_1: [{ count: 0, labels: {} }],
30
- project_2: [{ count: 6, labels: {} }],
31
- project_3: [{ count: 3, labels: { is_public: true } },
32
- { count: 6, labels: { is_public: false } }]
29
+ project1: [{ count: 0, labels: {} }],
30
+ project2: [{ count: 6, labels: {} }],
31
+ project3: [{ count: 3, labels: { is_public: true } },
32
+ { count: 6, labels: { is_public: false } }]
33
33
  )
34
34
  end
35
35
 
36
36
  context "when selected_queries is passed" do
37
- let(:collector) { described_class.new(connection_string: "host=localhost", selected_queries: ["project_2"]) }
37
+ let(:collector) { described_class.new(connection_string: "host=localhost", selected_queries: ["project2"]) }
38
38
 
39
39
  it "executes the selected queries" do
40
- expect(collector.run).to eq(project_2: [{ count: 6, labels: {} }])
40
+ expect(collector.run).to eq(project2: [{ count: 6, labels: {} }])
41
41
  end
42
42
  end
43
43
  end
44
44
 
45
45
  describe "#construct_query" do
46
46
  it "accepts a table and where clause" do
47
- expect(collector.send(:construct_query, query[:project_1])).to eq "SELECT COUNT(*) FROM projects WHERE id=1;"
47
+ expect(collector.send(:construct_query, query[:project1])).to eq "SELECT COUNT(*) FROM projects WHERE id=1;"
48
48
  end
49
49
 
50
50
  it "accepts a table and group (field) clause" do
51
- expect(collector.send(:construct_query, query[:project_3])).to eq \
51
+ expect(collector.send(:construct_query, query[:project3])).to eq \
52
52
  "SELECT COUNT(*), (visibility_level == 20) AS is_public FROM projects GROUP BY is_public;"
53
53
  end
54
54
  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: 15.6.0
4
+ version: 16.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pablo Carranza
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.2.5
19
+ version: 2.5.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.2.5
26
+ version: 2.5.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: deep_merge
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -42,50 +42,44 @@ dependencies:
42
42
  name: faraday
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: 1.8.0
48
- - - "<="
45
+ - - '='
49
46
  - !ruby/object:Gem::Version
50
- version: 2.8.1
47
+ version: 2.13.4
51
48
  type: :runtime
52
49
  prerelease: false
53
50
  version_requirements: !ruby/object:Gem::Requirement
54
51
  requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- version: 1.8.0
58
- - - "<="
52
+ - - '='
59
53
  - !ruby/object:Gem::Version
60
- version: 2.8.1
54
+ version: 2.13.4
61
55
  - !ruby/object:Gem::Dependency
62
56
  name: pg
63
57
  requirement: !ruby/object:Gem::Requirement
64
58
  requirements:
65
59
  - - '='
66
60
  - !ruby/object:Gem::Version
67
- version: 1.5.9
61
+ version: 1.6.1
68
62
  type: :runtime
69
63
  prerelease: false
70
64
  version_requirements: !ruby/object:Gem::Requirement
71
65
  requirements:
72
66
  - - '='
73
67
  - !ruby/object:Gem::Version
74
- version: 1.5.9
68
+ version: 1.6.1
75
69
  - !ruby/object:Gem::Dependency
76
70
  name: puma
77
71
  requirement: !ruby/object:Gem::Requirement
78
72
  requirements:
79
73
  - - '='
80
74
  - !ruby/object:Gem::Version
81
- version: 5.6.8
75
+ version: 6.6.1
82
76
  type: :runtime
83
77
  prerelease: false
84
78
  version_requirements: !ruby/object:Gem::Requirement
85
79
  requirements:
86
80
  - - '='
87
81
  - !ruby/object:Gem::Version
88
- version: 5.6.8
82
+ version: 6.6.1
89
83
  - !ruby/object:Gem::Dependency
90
84
  name: quantile
91
85
  requirement: !ruby/object:Gem::Requirement
@@ -106,28 +100,28 @@ dependencies:
106
100
  requirements:
107
101
  - - '='
108
102
  - !ruby/object:Gem::Version
109
- version: 4.5.0
103
+ version: 4.8.1
110
104
  type: :runtime
111
105
  prerelease: false
112
106
  version_requirements: !ruby/object:Gem::Requirement
113
107
  requirements:
114
108
  - - '='
115
109
  - !ruby/object:Gem::Version
116
- version: 4.5.0
110
+ version: 4.8.1
117
111
  - !ruby/object:Gem::Dependency
118
112
  name: redis-namespace
119
113
  requirement: !ruby/object:Gem::Requirement
120
114
  requirements:
121
115
  - - '='
122
116
  - !ruby/object:Gem::Version
123
- version: 1.9.0
117
+ version: 1.11.0
124
118
  type: :runtime
125
119
  prerelease: false
126
120
  version_requirements: !ruby/object:Gem::Requirement
127
121
  requirements:
128
122
  - - '='
129
123
  - !ruby/object:Gem::Version
130
- version: 1.9.0
124
+ version: 1.11.0
131
125
  - !ruby/object:Gem::Dependency
132
126
  name: sidekiq
133
127
  requirement: !ruby/object:Gem::Requirement
@@ -148,28 +142,28 @@ dependencies:
148
142
  requirements:
149
143
  - - "~>"
150
144
  - !ruby/object:Gem::Version
151
- version: 2.2.0
145
+ version: 3.2.0
152
146
  type: :runtime
153
147
  prerelease: false
154
148
  version_requirements: !ruby/object:Gem::Requirement
155
149
  requirements:
156
150
  - - "~>"
157
151
  - !ruby/object:Gem::Version
158
- version: 2.2.0
152
+ version: 3.2.0
159
153
  - !ruby/object:Gem::Dependency
160
154
  name: webrick
161
155
  requirement: !ruby/object:Gem::Requirement
162
156
  requirements:
163
157
  - - "~>"
164
158
  - !ruby/object:Gem::Version
165
- version: '1.7'
159
+ version: '1.9'
166
160
  type: :runtime
167
161
  prerelease: false
168
162
  version_requirements: !ruby/object:Gem::Requirement
169
163
  requirements:
170
164
  - - "~>"
171
165
  - !ruby/object:Gem::Version
172
- version: '1.7'
166
+ version: '1.9'
173
167
  - !ruby/object:Gem::Dependency
174
168
  name: rspec
175
169
  requirement: !ruby/object:Gem::Requirement
@@ -275,7 +269,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
275
269
  requirements:
276
270
  - - ">="
277
271
  - !ruby/object:Gem::Version
278
- version: '0'
272
+ version: '3.0'
279
273
  required_rubygems_version: !ruby/object:Gem::Requirement
280
274
  requirements:
281
275
  - - ">="