gitlab-exporter 8.0.0 → 10.2.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: 37cc46db50f1361ccd9451418ad48edefaaa696d58af41c8a09f96a61aea93f9
4
- data.tar.gz: 853e76cd0bee22d18e941c67588cbc06b3761098a604f382d87bcc8acbdb4555
3
+ metadata.gz: b54a7fd5cab81e9ffb2fe44bdff47d707c2a1cb2d31aa606246fd66ed3b15adf
4
+ data.tar.gz: f0d096e1a97a28f81ff360bad1925aa9abb764724387ec92f843a5184fead7b0
5
5
  SHA512:
6
- metadata.gz: 11bec1adc02cbdac35bfe5bf699e12ae3008cf7ce54681ab73f0f176030a6d087d11ab08c5bb8ace5fee60efb48e66061e53fe904537274dc7ec76fbb90b2b76
7
- data.tar.gz: eea37ccb83c041df049402d9a9aa471bc46f1892251bff3aa1149f1124db2847be7a874f3b0bba32df2bf3c6e8dd2e55e7dcddf66c782ef20e010fba18855407
6
+ metadata.gz: ab3fe334be8aeab22baf7ddddd2d4d6e650d6a8d30e290c98ef440205bf522c80338f311796bd1a2003a780a55ae8d5e9bd1fd71a51c3c61ed394a297fae700a
7
+ data.tar.gz: 874907c793cb4bf1947cc40a4fbf0bbfb70eb95a5769971688f64285346b01bf87ec45bd367cb44aec0c58fb3d1bcd369500d46e0f498a8a1fc0c73757d9c08f
data/.gitlab-ci.yml CHANGED
@@ -7,7 +7,7 @@ include:
7
7
  - template: Security/Secret-Detection.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab-foss/-/blob/master/lib/gitlab/ci/templates/Security/Secret-Detection.gitlab-ci.yml
8
8
 
9
9
  default:
10
- image: "ruby:2.3"
10
+ image: ruby:2.7
11
11
  cache:
12
12
  paths:
13
13
  - vendor
data/.rubocop.yml CHANGED
@@ -1,5 +1,7 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
1
3
  AllCops:
2
- TargetRubyVersion: 2.3
4
+ TargetRubyVersion: 2.7
3
5
  DisplayCopNames: true
4
6
 
5
7
  # Just use double quotes please
@@ -20,15 +22,15 @@ Style/RaiseArgs:
20
22
  Style/FrozenStringLiteralComment:
21
23
  Enabled: false
22
24
 
25
+ # Commonly used screens these days easily fit more than 80 characters.
26
+ Layout/LineLength:
27
+ Max: 120
28
+
23
29
  Metrics/MethodLength:
24
30
  Max: 15
25
31
 
26
32
  Metrics/AbcSize:
27
33
  Enabled: false
28
34
 
29
- # Commonly used screens these days easily fit more than 80 characters.
30
- Metrics/LineLength:
31
- Max: 120
32
-
33
35
  Metrics/ClassLength:
34
36
  Max: 150
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,64 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2021-01-11 12:24:03 UTC using RuboCop version 0.93.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Configuration parameters: Include.
11
+ # Include: **/*.gemspec
12
+ Gemspec/RequiredRubyVersion:
13
+ Exclude:
14
+ - 'gitlab-exporter.gemspec'
15
+
16
+ # Offense count: 3
17
+ Lint/AmbiguousBlockAssociation:
18
+ Exclude:
19
+ - 'spec/git_spec.rb'
20
+ - 'spec/util_spec.rb'
21
+
22
+ # Offense count: 2
23
+ # Configuration parameters: MaximumRangeSize.
24
+ Lint/MissingCopEnableDirective:
25
+ Exclude:
26
+ - 'spec/database/ci_builds_spec.rb'
27
+ - 'spec/git_process_proper_spec.rb'
28
+
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
38
+ Metrics/BlockLength:
39
+ Max: 349
40
+
41
+ # Offense count: 1
42
+ # Configuration parameters: IgnoredMethods.
43
+ Metrics/CyclomaticComplexity:
44
+ Max: 8
45
+
46
+ # Offense count: 1
47
+ # Configuration parameters: IgnoredMethods.
48
+ Metrics/PerceivedComplexity:
49
+ Max: 9
50
+
51
+ # Offense count: 1
52
+ # Configuration parameters: EnforcedStyle, AllowModifiersOnSymbols.
53
+ # SupportedStyles: inline, group
54
+ Style/AccessModifierDeclarations:
55
+ Exclude:
56
+ - 'lib/gitlab_exporter/util.rb'
57
+
58
+ # Offense count: 2
59
+ # Cop supports --auto-correct.
60
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
61
+ # AllowedMethods: present?, blank?, presence, try, try!
62
+ Style/SafeNavigation:
63
+ Exclude:
64
+ - 'lib/gitlab_exporter/database/base.rb'
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.2
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-exporter (8.0.0)
4
+ gitlab-exporter (10.2.0)
5
5
  connection_pool (~> 2.2.1)
6
6
  pg (~> 1.1)
7
+ puma (~> 5.1.1)
7
8
  quantile (~> 0.2.0)
8
9
  redis (~> 4.1.2)
9
10
  redis-namespace (~> 1.6.0)
@@ -13,23 +14,28 @@ PATH
13
14
  GEM
14
15
  remote: https://rubygems.org/
15
16
  specs:
16
- ast (2.4.0)
17
- connection_pool (2.2.3)
17
+ ast (2.4.1)
18
+ connection_pool (2.2.5)
18
19
  diff-lcs (1.3)
19
20
  mustermann (1.1.1)
20
21
  ruby2_keywords (~> 0.0.1)
21
- parser (2.5.1.0)
22
- ast (~> 2.4.0)
22
+ nio4r (2.5.7)
23
+ parallel (1.20.1)
24
+ parser (3.0.0.0)
25
+ ast (~> 2.4.1)
23
26
  pg (1.2.3)
24
- powerpack (0.1.1)
27
+ puma (5.1.1)
28
+ nio4r (~> 2.0)
25
29
  quantile (0.2.1)
26
30
  rack (2.2.3)
27
31
  rack-protection (2.0.8.1)
28
32
  rack
29
- rainbow (2.1.0)
33
+ rainbow (3.0.0)
30
34
  redis (4.1.4)
31
35
  redis-namespace (1.6.0)
32
36
  redis (>= 3.0.4)
37
+ regexp_parser (2.0.3)
38
+ rexml (3.2.4)
33
39
  rspec (3.7.0)
34
40
  rspec-core (~> 3.7.0)
35
41
  rspec-expectations (~> 3.7.0)
@@ -43,14 +49,19 @@ GEM
43
49
  diff-lcs (>= 1.2.0, < 2.0)
44
50
  rspec-support (~> 3.7.0)
45
51
  rspec-support (3.7.1)
46
- rubocop (0.42.0)
47
- parser (>= 2.3.1.1, < 3.0)
48
- powerpack (~> 0.1)
49
- rainbow (>= 1.99.1, < 3.0)
52
+ rubocop (0.93.1)
53
+ parallel (~> 1.10)
54
+ parser (>= 2.7.1.5)
55
+ rainbow (>= 2.2.2, < 4.0)
56
+ regexp_parser (>= 1.8)
57
+ rexml
58
+ rubocop-ast (>= 0.6.0)
50
59
  ruby-progressbar (~> 1.7)
51
- unicode-display_width (~> 1.0, >= 1.0.1)
52
- ruby-progressbar (1.8.1)
53
- ruby2_keywords (0.0.2)
60
+ unicode-display_width (>= 1.4.0, < 2.0)
61
+ rubocop-ast (1.4.0)
62
+ parser (>= 2.7.1.5)
63
+ ruby-progressbar (1.11.0)
64
+ ruby2_keywords (0.0.4)
54
65
  sidekiq (5.2.9)
55
66
  connection_pool (~> 2.2, >= 2.2.2)
56
67
  rack (~> 2.0)
@@ -62,7 +73,7 @@ GEM
62
73
  rack-protection (= 2.0.8.1)
63
74
  tilt (~> 2.0)
64
75
  tilt (2.0.10)
65
- unicode-display_width (1.6.0)
76
+ unicode-display_width (1.7.0)
66
77
 
67
78
  PLATFORMS
68
79
  ruby
@@ -74,4 +85,4 @@ DEPENDENCIES
74
85
  rubocop (~> 0.42)
75
86
 
76
87
  BUNDLED WITH
77
- 1.17.3
88
+ 2.1.4
data/README.md CHANGED
@@ -33,23 +33,6 @@ metrics.
33
33
  * [git pull/push timings](lib/gitlab_exporter/git.rb) --
34
34
  `git_pull_time_milliseconds`, `git_push_time_milliseconds`
35
35
  * git processes stats (see Process below)
36
- 1. [Process](lib/gitlab_exporter/process.rb)
37
- * CPU time -- `process_cpu_seconds_total`
38
- * Start time -- `process_start_time_seconds`
39
- * Count -- `process_count`
40
- * Memory usage
41
- * Data from /proc/<pid>/cmdline:
42
- * `process_resident_memory_bytes`
43
- * `process_virtual_memory_bytes`
44
- * Data from /proc/<pid>/smaps -- `probe_smaps` (off by default):
45
- * `process_smaps_size_bytes`
46
- * `process_smaps_rss_bytes`
47
- * `process_smaps_shared_clean_bytes`
48
- * `process_smaps_shared_dirty_bytes`
49
- * `process_smaps_private_clean_bytes`
50
- * `process_smaps_private_dirty_bytes`
51
- * `process_smaps_swap_bytes`
52
- * `process_smaps_pss_bytes`
53
36
  1. [Sidekiq](lib/gitlab_exporter/sidekiq.rb)
54
37
  * Stats
55
38
  * `sidekiq_jobs_processed_total`
data/bin/gitlab-exporter CHANGED
@@ -1,7 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
3
+ $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
4
4
 
5
+ require "rubygems"
6
+ require "bundler"
7
+ require "bundler/setup"
5
8
  require "optparse"
6
9
  require "gitlab_exporter"
7
10
 
@@ -46,7 +46,6 @@ probes:
46
46
  <<: *db_common
47
47
  opts:
48
48
  <<: *db_common_opts
49
- allowed_repeated_commands_count: 2
50
49
  created_builds_counting_disabled: true
51
50
  unarchived_traces_offset_minutes: 1440
52
51
  tuple_stats:
@@ -95,12 +94,21 @@ probes:
95
94
  redis_url: "redis://localhost:6379"
96
95
  redis_enable_client: true
97
96
 
97
+ ruby: &ruby
98
+ class_name: RubyProber
99
+ methods:
100
+ - probe_gc
101
+ opts:
102
+ quantiles: false
103
+
98
104
  metrics:
99
105
  multiple: true
100
106
  git_process:
101
107
  <<: *git_process
102
108
  process:
103
109
  <<: *process
110
+ ruby:
111
+ <<: *ruby
104
112
  sidekiq:
105
113
  <<: *sidekiq
106
114
  ci_builds:
@@ -1,4 +1,4 @@
1
- lib = File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path("lib", __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require "gitlab_exporter/version"
4
4
 
@@ -20,13 +20,14 @@ Gem::Specification.new do |s|
20
20
  s.homepage = "http://gitlab.com"
21
21
  s.license = "MIT"
22
22
 
23
+ s.add_runtime_dependency "connection_pool", "~> 2.2.1"
23
24
  s.add_runtime_dependency "pg", "~> 1.1"
24
- s.add_runtime_dependency "sinatra", "~> 2.0.4"
25
+ s.add_runtime_dependency "puma", "~> 5.1.1"
25
26
  s.add_runtime_dependency "quantile", "~> 0.2.0"
26
- s.add_runtime_dependency "sidekiq", "~> 5.2.1"
27
27
  s.add_runtime_dependency "redis", "~> 4.1.2"
28
28
  s.add_runtime_dependency "redis-namespace", "~> 1.6.0"
29
- s.add_runtime_dependency "connection_pool", "~> 2.2.1"
29
+ s.add_runtime_dependency "sidekiq", "~> 5.2.1"
30
+ s.add_runtime_dependency "sinatra", "~> 2.0.4"
30
31
 
31
32
  s.add_development_dependency "rspec", "~> 3.7.0"
32
33
  s.add_development_dependency "rspec-expectations", "~> 3.7.0"
@@ -14,5 +14,6 @@ module GitLab
14
14
  autoload :WebExporter, "gitlab_exporter/web_exporter"
15
15
  autoload :Prober, "gitlab_exporter/prober"
16
16
  autoload :SidekiqProber, "gitlab_exporter/sidekiq"
17
+ autoload :RubyProber, "gitlab_exporter/ruby"
17
18
  end
18
19
  end
@@ -19,8 +19,7 @@ module GitLab
19
19
  # Empty runner that will raise an InvalidCLICommand when executed to provide the usage
20
20
  # in the exception message
21
21
  class NullRunner
22
- def initialize(args)
23
- end
22
+ def initialize(args); end
24
23
 
25
24
  def run
26
25
  fail InvalidCLICommand.new("Usage: #{EXECUTABLE_NAME} <command> [options] [arguments...]\n\n"\
@@ -8,14 +8,39 @@ module GitLab
8
8
  #
9
9
  # It takes a connection string (e.g. "dbname=test port=5432")
10
10
  class Base
11
+ POOL_SIZE = 3
12
+
13
+ # This timeout is configured to higher interval than scrapping
14
+ # of Prometheus to ensure that connection is kept instead of
15
+ # needed to be re-initialized
16
+ POOL_TIMEOUT = 90
17
+
11
18
  def self.connection_pool
12
- @connection_pool ||= Hash.new do |h, connection_string|
13
- h[connection_string] = ConnectionPool.new(size: 3, timeout: 5) do
14
- PG.connect(connection_string)
19
+ @@connection_pool ||= Hash.new do |h, connection_string| # rubocop:disable Style/ClassVars
20
+ h[connection_string] = ConnectionPool.new(size: POOL_SIZE, timeout: POOL_TIMEOUT) do
21
+ PG.connect(connection_string).tap do |conn|
22
+ configure_type_map_for_results(conn)
23
+ end
15
24
  end
16
25
  end
17
26
  end
18
27
 
28
+ def self.configure_type_map_for_results(conn)
29
+ tm = PG::BasicTypeMapForResults.new(conn)
30
+
31
+ # Remove warning message:
32
+ # Warning: no type cast defined for type "name" with oid 19.
33
+ # Please cast this type explicitly to TEXT to be safe for future changes.
34
+ # Warning: no type cast defined for type "regproc" with oid 24.
35
+ # Please cast this type explicitly to TEXT to be safe for future changes.
36
+ [{ "type": "text", "oid": 19 }, { "type": "int4", "oid": 24 }].each do |value|
37
+ old_coder = tm.coders.find { |c| c.name == value[:type] }
38
+ tm.add_coder(old_coder.dup.tap { |c| c.oid = value[:oid] })
39
+ end
40
+
41
+ conn.type_map_for_results = tm
42
+ end
43
+
19
44
  def initialize(args, logger: nil)
20
45
  @connection_string = args[:connection_string]
21
46
  @logger = logger
@@ -31,13 +56,11 @@ module GitLab
31
56
 
32
57
  def with_connection_pool
33
58
  connection_pool.with do |conn|
34
- begin
35
- yield conn
36
- rescue PG::UnableToSend => e
37
- @logger.warn "Error sending to the database: #{e}" if @logger
38
- conn.reset
39
- raise e
40
- end
59
+ yield conn
60
+ rescue PG::UnableToSend => e
61
+ @logger.warn "Error sending to the database: #{e}" if @logger
62
+ conn.reset
63
+ raise e
41
64
  end
42
65
  rescue PG::Error => e
43
66
  @logger.error "Error connecting to the database: #{e}" if @logger
@@ -35,7 +35,7 @@ module GitLab
35
35
 
36
36
  # Prober class to gather bloat metrics
37
37
  class BloatProber
38
- METRIC_KEYS = %w(bloat_ratio bloat_size extra_size real_size).freeze
38
+ METRIC_KEYS = %w[bloat_ratio bloat_size extra_size real_size].freeze
39
39
 
40
40
  attr_reader :metrics, :collector, :bloat_types
41
41
 
@@ -46,7 +46,7 @@ module GitLab
46
46
  @metrics = metrics
47
47
  @collector = collector
48
48
  @collector.logger = logger
49
- @bloat_types = opts[:bloat_types] || %i(btree table)
49
+ @bloat_types = opts[:bloat_types] || %i[btree table]
50
50
  end
51
51
 
52
52
  def probe_db
@@ -147,100 +147,6 @@ module GitLab
147
147
  SELECT COUNT(*) FROM licenses
148
148
  SQL
149
149
 
150
- REPEATED_COMMANDS_QUERY_EE =
151
- <<~SQL.freeze
152
- SELECT
153
- subquery.namespace_id,
154
- subquery.shared_runners_enabled,
155
- subquery.project_id,
156
- subquery.status,
157
- subquery.has_minutes,
158
- MAX(subquery.count) as count
159
- FROM (
160
- SELECT
161
- projects.namespace_id,
162
- projects.shared_runners_enabled,
163
- ci_builds.project_id,
164
- ci_builds.commit_id,
165
- ci_builds.status,
166
- (COALESCE(namespaces.shared_runners_minutes_limit, application_settings.shared_runners_minutes, 0) = 0 OR
167
- COALESCE(namespace_statistics.shared_runners_seconds, 0) < COALESCE(namespaces.shared_runners_minutes_limit, application_settings.shared_runners_minutes, 0) * 60) as has_minutes,
168
- COUNT(*) AS count
169
- FROM ci_builds
170
- JOIN projects
171
- ON projects.id = ci_builds.project_id
172
- JOIN namespaces
173
- ON namespaces.id = projects.namespace_id
174
- LEFT JOIN namespace_statistics
175
- ON namespace_statistics.namespace_id = namespaces.id
176
- JOIN application_settings ON (TRUE)
177
- WHERE ci_builds.type = 'Ci::Build'
178
- AND ci_builds.status IN ('running', 'pending')
179
- -- The created_at filter has been introduced for performance reasons only
180
- AND ci_builds.created_at > NOW() - INTERVAL '7 days'
181
- GROUP BY
182
- projects.namespace_id,
183
- projects.shared_runners_enabled,
184
- ci_builds.project_id,
185
- ci_builds.commit_id,
186
- ci_builds.status,
187
- ci_builds.commands,
188
- namespaces.shared_runners_minutes_limit,
189
- namespace_statistics.shared_runners_seconds,
190
- application_settings.shared_runners_minutes
191
- HAVING COUNT(*) > %d
192
- ) AS subquery
193
- GROUP BY
194
- subquery.namespace_id,
195
- subquery.shared_runners_enabled,
196
- subquery.project_id,
197
- subquery.commit_id,
198
- subquery.status,
199
- subquery.has_minutes
200
- SQL
201
-
202
- REPEATED_COMMANDS_QUERY_CE =
203
- <<~SQL.freeze
204
- SELECT
205
- subquery.namespace_id,
206
- subquery.shared_runners_enabled,
207
- subquery.project_id,
208
- subquery.status,
209
- MAX(subquery.count) as count
210
- FROM (
211
- SELECT
212
- projects.namespace_id,
213
- projects.shared_runners_enabled,
214
- ci_builds.project_id,
215
- ci_builds.commit_id,
216
- ci_builds.status,
217
- COUNT(*) AS count
218
- FROM ci_builds
219
- JOIN projects
220
- ON projects.id = ci_builds.project_id
221
- JOIN namespaces
222
- ON namespaces.id = projects.namespace_id
223
- WHERE ci_builds.type = 'Ci::Build'
224
- AND ci_builds.status IN ('running', 'pending')
225
- -- The created_at filter has been introduced for performance reasons only
226
- AND ci_builds.created_at > NOW() - INTERVAL '7 days'
227
- GROUP BY
228
- projects.namespace_id,
229
- projects.shared_runners_enabled,
230
- ci_builds.project_id,
231
- ci_builds.commit_id,
232
- ci_builds.status,
233
- ci_builds.commands
234
- HAVING COUNT(*) > %d
235
- ) AS subquery
236
- GROUP BY
237
- subquery.namespace_id,
238
- subquery.shared_runners_enabled,
239
- subquery.project_id,
240
- subquery.commit_id,
241
- subquery.status
242
- SQL
243
-
244
150
  UNARCHIVED_TRACES_QUERY =
245
151
  <<~SQL.freeze
246
152
  SELECT
@@ -265,7 +171,6 @@ module GitLab
265
171
  def initialize(opts, logger: nil)
266
172
  super(opts, logger: logger)
267
173
 
268
- @allowed_repeated_commands_count = opts[:allowed_repeated_commands_count]
269
174
  @created_builds_counting_disabled = opts[:created_builds_counting_disabled]
270
175
  @unarchived_traces_offset_minutes = opts[:unarchived_traces_offset_minutes]
271
176
  end
@@ -276,7 +181,6 @@ module GitLab
276
181
  results[:pending_builds] = builds(STATUS_PENDING)
277
182
  results[:stale_builds] = stale_builds
278
183
  results[:per_runner] = per_runner_builds
279
- results[:repeated_commands] = repeated_commands
280
184
  results[:unarchived_traces] = unarchived_traces
281
185
  results
282
186
  end
@@ -335,34 +239,6 @@ module GitLab
335
239
  include_ee_fields(values, row)
336
240
  end
337
241
 
338
- def repeated_commands
339
- results = []
340
-
341
- query = ee? ? REPEATED_COMMANDS_QUERY_EE : REPEATED_COMMANDS_QUERY_CE
342
- query = query % [allowed_repeated_commands_count] # rubocop:disable Style/FormatString
343
- exec_query_with_custom_random_page_cost(query).each do |row|
344
- results << transform_repeated_commands_row_to_values(row)
345
- end
346
-
347
- results
348
- rescue PG::UndefinedTable, PG::UndefinedColumn
349
- []
350
- end
351
-
352
- def allowed_repeated_commands_count
353
- @allowed_repeated_commands_count ||= 2
354
- end
355
-
356
- def transform_repeated_commands_row_to_values(row)
357
- values = { namespace: row["namespace_id"].to_s,
358
- project: row["project_id"].to_s,
359
- shared_runners: row["shared_runners_enabled"] == "t" ? "yes" : "no",
360
- status: row["status"].to_s,
361
- value: row["count"].to_i }
362
-
363
- include_has_minutes_field(values, row)
364
- end
365
-
366
242
  def unarchived_traces
367
243
  time = Time.now - (unarchived_traces_offset_minutes * 60)
368
244
  query = UNARCHIVED_TRACES_QUERY % [time.strftime("%F %T")] # rubocop:disable Style/FormatString
@@ -391,6 +267,7 @@ module GitLab
391
267
 
392
268
  def include_bool_if_row_defined(row, field)
393
269
  return {} unless row[field.to_s]
270
+
394
271
  { field => row[field.to_s] == "t" ? "yes" : "no" }
395
272
  end
396
273
 
@@ -421,7 +298,6 @@ module GitLab
421
298
  @metrics = metrics
422
299
 
423
300
  collector_opts = { connection_string: opts[:connection_string],
424
- allowed_repeated_commands_count: opts[:allowed_repeated_commands_count],
425
301
  created_builds_counting_disabled: opts[:created_builds_counting_disabled],
426
302
  unarchived_traces_offset_minutes: opts[:unarchived_traces_offset_minutes] }
427
303
  @collector = CiBuildsCollector.new(collector_opts, logger: logger)
@@ -434,7 +310,6 @@ module GitLab
434
310
  ci_builds_metrics(@results[:pending_builds], "ci_pending_builds")
435
311
  ci_stale_builds_metrics
436
312
  metrics_per_runner
437
- repeated_commands_metrics
438
313
  unarchived_traces_metrics
439
314
 
440
315
  self
@@ -470,7 +345,7 @@ module GitLab
470
345
 
471
346
  def add_ci_created_pending_builds(metric_name, value, labels)
472
347
  add_metric_with_namespace_label(metric_name,
473
- [:namespace, :shared_runners, :has_minutes],
348
+ %i[namespace shared_runners has_minutes],
474
349
  value,
475
350
  labels)
476
351
  end
@@ -505,8 +380,8 @@ module GitLab
505
380
  def add_ci_running_builds(value, labels)
506
381
  add_metric_with_namespace_label(
507
382
  "ci_running_builds",
508
- [:runner, :namespace, :runner_type, :scheduled,
509
- :triggered, :mirror, :mirror_trigger_builds, :has_minutes],
383
+ %i[runner namespace runner_type scheduled
384
+ triggered mirror mirror_trigger_builds has_minutes],
510
385
  value,
511
386
  labels
512
387
  )
@@ -519,14 +394,6 @@ module GitLab
519
394
  @metrics.add(metric_name, value.to_f, selected_labels)
520
395
  end
521
396
 
522
- def repeated_commands_metrics
523
- @results[:repeated_commands].each do |metric|
524
- value = metric.delete(:value)
525
-
526
- @metrics.add("ci_repeated_commands_builds", value.to_f, metric)
527
- end
528
- end
529
-
530
397
  def unarchived_traces_metrics
531
398
  @metrics.add("ci_unarchived_traces", @results[:unarchived_traces].to_f)
532
399
  end