gitlab-exporter 8.0.0 → 9.0.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: b3fb1c9119047242e695cb956c7a68f7c19f564f7a274c8d503b7d4b984eed03
4
+ data.tar.gz: fb77e078e08dbc9f8f81a1a82dc070944fbf49af3944c90a8e30eac59ca1c39a
5
5
  SHA512:
6
- metadata.gz: 11bec1adc02cbdac35bfe5bf699e12ae3008cf7ce54681ab73f0f176030a6d087d11ab08c5bb8ace5fee60efb48e66061e53fe904537274dc7ec76fbb90b2b76
7
- data.tar.gz: eea37ccb83c041df049402d9a9aa471bc46f1892251bff3aa1149f1124db2847be7a874f3b0bba32df2bf3c6e8dd2e55e7dcddf66c782ef20e010fba18855407
6
+ metadata.gz: 0c75097275454229a38f351618bc7eef530534726fa16d3d06b1c8fb95d5fdacc43a84d4d9781963bf27b8afc7700699bfe32d5f0f8516403edf7d5fa5a6555a
7
+ data.tar.gz: 1eb96b35d5a80166dc5f587dce7de896d7533cf5822d5a17b220c0d09d858b01e5d02cfc7bbd8710b6002591efd9181cfab063b8fa8bfee698beca672536e83a
@@ -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
@@ -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
@@ -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'
@@ -0,0 +1 @@
1
+ 2.7.2
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-exporter (8.0.0)
4
+ gitlab-exporter (9.0.0)
5
5
  connection_pool (~> 2.2.1)
6
6
  pg (~> 1.1)
7
7
  quantile (~> 0.2.0)
@@ -13,23 +13,25 @@ PATH
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- ast (2.4.0)
16
+ ast (2.4.1)
17
17
  connection_pool (2.2.3)
18
18
  diff-lcs (1.3)
19
19
  mustermann (1.1.1)
20
20
  ruby2_keywords (~> 0.0.1)
21
- parser (2.5.1.0)
22
- ast (~> 2.4.0)
21
+ parallel (1.20.1)
22
+ parser (3.0.0.0)
23
+ ast (~> 2.4.1)
23
24
  pg (1.2.3)
24
- powerpack (0.1.1)
25
25
  quantile (0.2.1)
26
26
  rack (2.2.3)
27
27
  rack-protection (2.0.8.1)
28
28
  rack
29
- rainbow (2.1.0)
29
+ rainbow (3.0.0)
30
30
  redis (4.1.4)
31
31
  redis-namespace (1.6.0)
32
32
  redis (>= 3.0.4)
33
+ regexp_parser (2.0.3)
34
+ rexml (3.2.4)
33
35
  rspec (3.7.0)
34
36
  rspec-core (~> 3.7.0)
35
37
  rspec-expectations (~> 3.7.0)
@@ -43,13 +45,18 @@ GEM
43
45
  diff-lcs (>= 1.2.0, < 2.0)
44
46
  rspec-support (~> 3.7.0)
45
47
  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)
48
+ rubocop (0.93.1)
49
+ parallel (~> 1.10)
50
+ parser (>= 2.7.1.5)
51
+ rainbow (>= 2.2.2, < 4.0)
52
+ regexp_parser (>= 1.8)
53
+ rexml
54
+ rubocop-ast (>= 0.6.0)
50
55
  ruby-progressbar (~> 1.7)
51
- unicode-display_width (~> 1.0, >= 1.0.1)
52
- ruby-progressbar (1.8.1)
56
+ unicode-display_width (>= 1.4.0, < 2.0)
57
+ rubocop-ast (1.4.0)
58
+ parser (>= 2.7.1.5)
59
+ ruby-progressbar (1.11.0)
53
60
  ruby2_keywords (0.0.2)
54
61
  sidekiq (5.2.9)
55
62
  connection_pool (~> 2.2, >= 2.2.2)
@@ -62,7 +69,7 @@ GEM
62
69
  rack-protection (= 2.0.8.1)
63
70
  tilt (~> 2.0)
64
71
  tilt (2.0.10)
65
- unicode-display_width (1.6.0)
72
+ unicode-display_width (1.7.0)
66
73
 
67
74
  PLATFORMS
68
75
  ruby
@@ -74,4 +81,4 @@ DEPENDENCIES
74
81
  rubocop (~> 0.42)
75
82
 
76
83
  BUNDLED WITH
77
- 1.17.3
84
+ 2.1.4
@@ -1,6 +1,6 @@
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
5
  require "optparse"
6
6
  require "gitlab_exporter"
@@ -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,13 @@ 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
25
  s.add_runtime_dependency "quantile", "~> 0.2.0"
26
- s.add_runtime_dependency "sidekiq", "~> 5.2.1"
27
26
  s.add_runtime_dependency "redis", "~> 4.1.2"
28
27
  s.add_runtime_dependency "redis-namespace", "~> 1.6.0"
29
- s.add_runtime_dependency "connection_pool", "~> 2.2.1"
28
+ s.add_runtime_dependency "sidekiq", "~> 5.2.1"
29
+ s.add_runtime_dependency "sinatra", "~> 2.0.4"
30
30
 
31
31
  s.add_development_dependency "rspec", "~> 3.7.0"
32
32
  s.add_development_dependency "rspec-expectations", "~> 3.7.0"
@@ -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"\
@@ -31,13 +31,11 @@ module GitLab
31
31
 
32
32
  def with_connection_pool
33
33
  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
34
+ yield conn
35
+ rescue PG::UnableToSend => e
36
+ @logger.warn "Error sending to the database: #{e}" if @logger
37
+ conn.reset
38
+ raise e
41
39
  end
42
40
  rescue PG::Error => e
43
41
  @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
@@ -391,6 +391,7 @@ module GitLab
391
391
 
392
392
  def include_bool_if_row_defined(row, field)
393
393
  return {} unless row[field.to_s]
394
+
394
395
  { field => row[field.to_s] == "t" ? "yes" : "no" }
395
396
  end
396
397
 
@@ -470,7 +471,7 @@ module GitLab
470
471
 
471
472
  def add_ci_created_pending_builds(metric_name, value, labels)
472
473
  add_metric_with_namespace_label(metric_name,
473
- [:namespace, :shared_runners, :has_minutes],
474
+ %i[namespace shared_runners has_minutes],
474
475
  value,
475
476
  labels)
476
477
  end
@@ -505,8 +506,8 @@ module GitLab
505
506
  def add_ci_running_builds(value, labels)
506
507
  add_metric_with_namespace_label(
507
508
  "ci_running_builds",
508
- [:runner, :namespace, :runner_type, :scheduled,
509
- :triggered, :mirror, :mirror_trigger_builds, :has_minutes],
509
+ %i[runner namespace runner_type scheduled
510
+ triggered mirror mirror_trigger_builds has_minutes],
510
511
  value,
511
512
  labels
512
513
  )
@@ -29,7 +29,7 @@ module GitLab
29
29
 
30
30
  MIRROR_QUERY = {
31
31
  select: :projects,
32
- joins: <<~SQL,
32
+ joins: <<~SQL,
33
33
  INNER JOIN project_mirror_data ON project_mirror_data.project_id = projects.id
34
34
  INNER JOIN namespaces AS root_namespaces ON root_namespaces.id = (
35
35
  WITH RECURSIVE "base_and_ancestors" AS (
@@ -112,9 +112,9 @@ module GitLab
112
112
  ON users.id = u.user_id",
113
113
  where: "user_type IS NULL",
114
114
  fields: {
115
- admin: {},
116
- external: {},
117
- state: {},
115
+ admin: {},
116
+ external: {},
117
+ state: {},
118
118
  access_level: { definition: "COALESCE(u.access_level, 0)" }
119
119
  }
120
120
  },
@@ -122,14 +122,14 @@ module GitLab
122
122
  select: :projects,
123
123
  fields: {
124
124
  visibility_level: {},
125
- archived: {}
125
+ archived: {}
126
126
  }
127
127
  },
128
128
  groups: {
129
129
  select: :namespaces,
130
130
  fields: {
131
131
  visibility_level: {},
132
- root: { definition: "(parent_id IS NULL)" }
132
+ root: { definition: "(parent_id IS NULL)" }
133
133
  }
134
134
  }
135
135
  }.freeze
@@ -5,7 +5,7 @@ module GitLab
5
5
  #
6
6
  # It takes a connection string (e.g. "dbname=test port=5432")
7
7
  class TupleStatsCollector < Base
8
- COLUMNS = %w(relname seq_tup_read idx_tup_fetch n_tup_ins n_tup_upd n_tup_del n_tup_hot_upd n_dead_tup seq_scan)
8
+ COLUMNS = %w[relname seq_tup_read idx_tup_fetch n_tup_ins n_tup_upd n_tup_del n_tup_hot_upd n_dead_tup seq_scan]
9
9
  .join(",")
10
10
  QUERY = <<-SQL.freeze
11
11
  SELECT #{COLUMNS}
@@ -35,9 +35,11 @@ module GitLab
35
35
 
36
36
  result.each do |table_name, tuple_stats|
37
37
  tuple_stats.each do |column_name, value|
38
+ next if value.is_a?(Numeric)
39
+
38
40
  @metrics.add("gitlab_database_stat_table_#{column_name}",
39
41
  value.to_f,
40
- table_name: table_name) unless value.is_a?(Numeric)
42
+ table_name: table_name)
41
43
  end
42
44
  end
43
45
 
@@ -13,6 +13,7 @@ module GitLab
13
13
  class Git
14
14
  def initialize(repo)
15
15
  fail "Repository #{repo} does not exists" unless Dir.exist? repo
16
+
16
17
  @repo = repo
17
18
  @tracker = TimeTracker.new
18
19
  end
@@ -35,6 +36,7 @@ module GitLab
35
36
  def execute(command)
36
37
  result = CommandResult.new(*Open3.capture2e(command, chdir: @repo))
37
38
  fail "Command #{command} failed with status #{result.status}\n#{result.stdout}" if result.failed?
39
+
38
40
  result
39
41
  end
40
42
  end
@@ -96,7 +98,7 @@ module GitLab
96
98
  Utils.pgrep("^git ").each do |pid|
97
99
  process_cmd = begin
98
100
  File.read("/proc/#{pid}/cmdline")
99
- rescue
101
+ rescue StandardError
100
102
  "" # Process file is gone (race condition)
101
103
  end
102
104
  subcommand = self.class.extract_subcommand(process_cmd)
@@ -131,6 +133,7 @@ module GitLab
131
133
 
132
134
  def self.extract_subcommand(cmd)
133
135
  return if cmd.empty?
136
+
134
137
  cmd_splitted = cmd.split("\u0000") # cmdline does not return it space-separated
135
138
 
136
139
  cmd_splitted.shift # Because it's "git"
@@ -87,7 +87,7 @@ module GitLab
87
87
  end
88
88
  end
89
89
  end
90
- rescue => e
90
+ rescue StandardError => e
91
91
  puts "Error: #{e}"
92
92
  @valid = false
93
93
  create_memstats_not_available(totals)
@@ -25,7 +25,7 @@ module GitLab
25
25
  # Locked: 0 kB
26
26
  # VmFlags: rd ex mr mw me dw sd
27
27
  class Mapping
28
- FIELDS = %w(size rss shared_clean shared_dirty private_clean private_dirty swap pss).freeze
28
+ FIELDS = %w[size rss shared_clean shared_dirty private_clean private_dirty swap pss].freeze
29
29
 
30
30
  attr_reader :address_start
31
31
  attr_reader :address_end
@@ -105,9 +105,7 @@ module GitLab
105
105
  ::GitLab::Exporter::MemStats::Mapping::FIELDS.each do |field|
106
106
  value = stats.totals[field]
107
107
 
108
- if value >= 0
109
- @metrics.add("process_smaps_#{field}_bytes", value * 1024, @use_quantiles, **labels)
110
- end
108
+ @metrics.add("process_smaps_#{field}_bytes", value * 1024, @use_quantiles, **labels) if value >= 0
111
109
  end
112
110
  end
113
111
 
@@ -53,21 +53,19 @@ module GitLab
53
53
  self
54
54
  end
55
55
 
56
- def probe_jobs # rubocop:disable Metrics/MethodLength
56
+ def probe_jobs
57
57
  return self unless connected?
58
58
 
59
59
  job_stats = {}
60
60
 
61
61
  Sidekiq::Queue.all.each do |queue|
62
- begin
63
- Sidekiq.redis do |conn|
64
- stats = conn.evalsha(QUEUE_JOB_STATS_SHA, ["queue:#{queue.name}"])
65
- job_stats.merge!(stats.to_h)
66
- end
67
- rescue Redis::CommandError # Could happen if the script exceeded the maximum run time (5 seconds by default)
68
- # FIXME: Should we call SCRIPT KILL?
69
- return self
62
+ Sidekiq.redis do |conn|
63
+ stats = conn.evalsha(QUEUE_JOB_STATS_SHA, ["queue:#{queue.name}"])
64
+ job_stats.merge!(stats.to_h)
70
65
  end
66
+ rescue Redis::CommandError # Could happen if the script exceeded the maximum run time (5 seconds by default)
67
+ # FIXME: Should we call SCRIPT KILL?
68
+ return self
71
69
  end
72
70
 
73
71
  job_stats.each do |class_name, count|
@@ -153,7 +151,7 @@ module GitLab
153
151
  end
154
152
  true
155
153
  end
156
- rescue Redis::CannotConnectError, Redis::TimeoutError # rubocop:disable Lint/HandleExceptions
154
+ rescue Redis::CannotConnectError, Redis::TimeoutError
157
155
  # Maybe we're trying connecting to a slave
158
156
  end
159
157
 
@@ -164,6 +162,7 @@ module GitLab
164
162
  # Using administrative commands on conn directly (which is a Redis::Namespace)
165
163
  # will be removed in redis-namespace 2.0.
166
164
  next if conn.redis.script(:exists, QUEUE_JOB_STATS_SHA)
165
+
167
166
  conn.redis.script(:load, QUEUE_JOB_STATS_SCRIPT)
168
167
  end
169
168
  end
@@ -24,7 +24,7 @@ module GitLab
24
24
  # Helper methods, some stuff was copied from ActiveSupport
25
25
  module Utils
26
26
  def camel_case_string(str)
27
- str.gsub(/(?:_|^)([a-z\d]*)/i) { $1.capitalize } # rubocop:disable PerlBackrefs
27
+ str.gsub(/(?:_|^)([a-z\d]*)/i) { $1.capitalize } # rubocop:disable Style/PerlBackrefs
28
28
  end
29
29
  module_function :camel_case_string
30
30
 
@@ -1,5 +1,5 @@
1
1
  module GitLab
2
2
  module Exporter
3
- VERSION = "8.0.0".freeze
3
+ VERSION = "9.0.0".freeze
4
4
  end
5
5
  end
@@ -24,7 +24,7 @@ module GitLab
24
24
  private
25
25
 
26
26
  def memory_usage
27
- io = IO.popen(%W(ps -o rss= -p #{$PID}))
27
+ io = IO.popen(%W[ps -o rss= -p #{$PID}])
28
28
 
29
29
  mem = io.read
30
30
  io.close
@@ -26,7 +26,7 @@ describe GitLab::Exporter::Database::BloatCollector do
26
26
  end
27
27
 
28
28
  describe GitLab::Exporter::Database::BloatProber do
29
- let(:opts) { { bloat_types: %i(btree table) } }
29
+ let(:opts) { { bloat_types: %i[btree table] } }
30
30
  let(:metrics) { double("PrometheusMetrics", add: nil) }
31
31
  let(:collector) { double("BloatCollector", run: data) }
32
32
 
@@ -1,7 +1,7 @@
1
1
  require "spec_helper"
2
2
  require "gitlab_exporter/database/ci_builds"
3
3
 
4
- # rubocop:disable Metrics/LineLength
4
+ # rubocop:disable Layout/LineLength
5
5
  describe GitLab::Exporter::Database do
6
6
  let(:set_random_page_cost_query) { "SET random_page_cost" }
7
7
  let(:builds_query_ee) { "SELECT BUILDS EE" }
@@ -100,35 +100,35 @@ describe GitLab::Exporter::Database do
100
100
  allow(Time).to receive(:now).and_return(time_now)
101
101
 
102
102
  allow(connection).to receive(:exec).with(builds_query_ee)
103
- .and_return([builds_query_row_ee("f", "created", "1", "f", 10),
104
- builds_query_row_ee("t", "pending", "1", "t", 30),
105
- builds_query_row_ee("f", "created", "2", "f", 20),
106
- builds_query_row_ee("t", "pending", "2", "t", 50),
107
- builds_query_row_ee("t", "pending", "3", "f", 1),
108
- builds_query_row_ee("t", "pending", "4", "t", 2),
109
- builds_query_row_ee("f", "pending", "5", "f", 2)])
103
+ .and_return([builds_query_row_ee("f", "created", "1", "f", 10),
104
+ builds_query_row_ee("t", "pending", "1", "t", 30),
105
+ builds_query_row_ee("f", "created", "2", "f", 20),
106
+ builds_query_row_ee("t", "pending", "2", "t", 50),
107
+ builds_query_row_ee("t", "pending", "3", "f", 1),
108
+ builds_query_row_ee("t", "pending", "4", "t", 2),
109
+ builds_query_row_ee("f", "pending", "5", "f", 2)])
110
110
  allow(connection).to receive(:exec).with(builds_query_ce)
111
- .and_return([builds_query_row_ce("f", "created", "1", 10),
112
- builds_query_row_ce("t", "pending", "1", 30),
113
- builds_query_row_ce("f", "created", "2", 20),
114
- builds_query_row_ce("t", "pending", "2", 50),
115
- builds_query_row_ce("t", "pending", "3", 1),
116
- builds_query_row_ce("t", "pending", "4", 2),
117
- builds_query_row_ce("f", "pending", "5", 2)])
111
+ .and_return([builds_query_row_ce("f", "created", "1", 10),
112
+ builds_query_row_ce("t", "pending", "1", 30),
113
+ builds_query_row_ce("f", "created", "2", 20),
114
+ builds_query_row_ce("t", "pending", "2", 50),
115
+ builds_query_row_ce("t", "pending", "3", 1),
116
+ builds_query_row_ce("t", "pending", "4", 2),
117
+ builds_query_row_ce("f", "pending", "5", 2)])
118
118
 
119
119
  allow(connection).to receive(:exec).with(stale_builds_query).and_return([{ "count" => 2 }])
120
120
 
121
121
  allow(connection).to receive(:exec).with(per_runner_query_ee)
122
- .and_return([per_runner_query_row_ee(1, "instance_type", 1, "f", "f", 1, nil, "t", 15),
123
- per_runner_query_row_ee(2, "project_type", 2, "t", "t", nil, 3, "f", 5),
124
- per_runner_query_row_ee(2, "project_type", 3, "t", "t", nil, 3, "t", 5),
125
- per_runner_query_row_ee(3, "project_type", 4, "t", "t", nil, 3, "f", 5)])
122
+ .and_return([per_runner_query_row_ee(1, "instance_type", 1, "f", "f", 1, nil, "t", 15),
123
+ per_runner_query_row_ee(2, "project_type", 2, "t", "t", nil, 3, "f", 5),
124
+ per_runner_query_row_ee(2, "project_type", 3, "t", "t", nil, 3, "t", 5),
125
+ per_runner_query_row_ee(3, "project_type", 4, "t", "t", nil, 3, "f", 5)])
126
126
 
127
127
  allow(connection).to receive(:exec).with(per_runner_query_ce)
128
- .and_return([per_runner_query_row_ce(1, "instance_type", 1, 1, nil, 15),
129
- per_runner_query_row_ce(2, "project_type", 2, nil, 3, 5),
130
- per_runner_query_row_ce(2, "project_type", 3, nil, 3, 5),
131
- per_runner_query_row_ce(3, "project_type", 4, nil, 3, 5)])
128
+ .and_return([per_runner_query_row_ce(1, "instance_type", 1, 1, nil, 15),
129
+ per_runner_query_row_ce(2, "project_type", 2, nil, 3, 5),
130
+ per_runner_query_row_ce(2, "project_type", 3, nil, 3, 5),
131
+ per_runner_query_row_ce(3, "project_type", 4, nil, 3, 5)])
132
132
 
133
133
  # rubocop:disable Style/FormatString
134
134
  repeated_commands_query_ee_with_limit = repeated_commands_query_ee % [allowed_repeated_commands_count]
@@ -1,7 +1,7 @@
1
1
  require "spec_helper"
2
2
  require "gitlab_exporter"
3
3
 
4
- # rubocop:disable Metrics/LineLength
4
+ # rubocop:disable Layout/LineLength
5
5
  describe GitLab::Exporter::GitProcessProber do
6
6
  describe ".extract_subcommand" do
7
7
  it "extract git subcommand" do
@@ -14,11 +14,11 @@ describe GitLab::Exporter::MemStats do
14
14
  it "parses the data properly" do
15
15
  expect(subject.valid?).to be_truthy
16
16
 
17
- nonzero_fields = %w(size rss shared_clean shared_dirty private_dirty pss)
18
- zero_fields = %w(private_clean swap)
17
+ nonzero_fields = %w[size rss shared_clean shared_dirty private_dirty pss]
18
+ zero_fields = %w[private_clean swap]
19
19
 
20
20
  nonzero_fields.each do |field|
21
- expect(subject.totals[field]).to be > 0 # rubocop:disable Style/NumericPredicate
21
+ expect(subject.totals[field]).to be > 0
22
22
  end
23
23
 
24
24
  zero_fields.each do |field|
@@ -51,11 +51,9 @@ class CLIArgs
51
51
  yield self
52
52
  end
53
53
 
54
- def on(*args)
55
- end
54
+ def on(*args); end
56
55
 
57
- def banner=(banner)
58
- end
56
+ def banner=(banner); end
59
57
 
60
58
  def parse!
61
59
  @arguments
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: 8.0.0
4
+ version: 9.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pablo Carranza
@@ -11,33 +11,33 @@ cert_chain: []
11
11
  date: 2016-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: pg
14
+ name: connection_pool
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.1'
19
+ version: 2.2.1
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: '1.1'
26
+ version: 2.2.1
27
27
  - !ruby/object:Gem::Dependency
28
- name: sinatra
28
+ name: pg
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.0.4
33
+ version: '1.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.0.4
40
+ version: '1.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: quantile
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,61 +53,61 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.2.0
55
55
  - !ruby/object:Gem::Dependency
56
- name: sidekiq
56
+ name: redis
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 5.2.1
61
+ version: 4.1.2
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 5.2.1
68
+ version: 4.1.2
69
69
  - !ruby/object:Gem::Dependency
70
- name: redis
70
+ name: redis-namespace
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 4.1.2
75
+ version: 1.6.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 4.1.2
82
+ version: 1.6.0
83
83
  - !ruby/object:Gem::Dependency
84
- name: redis-namespace
84
+ name: sidekiq
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 1.6.0
89
+ version: 5.2.1
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 1.6.0
96
+ version: 5.2.1
97
97
  - !ruby/object:Gem::Dependency
98
- name: connection_pool
98
+ name: sinatra
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 2.2.1
103
+ version: 2.0.4
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 2.2.1
110
+ version: 2.0.4
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rspec
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -146,6 +146,8 @@ files:
146
146
  - ".gitignore"
147
147
  - ".gitlab-ci.yml"
148
148
  - ".rubocop.yml"
149
+ - ".rubocop_todo.yml"
150
+ - ".ruby-version"
149
151
  - CONTRIBUTING.md
150
152
  - Gemfile
151
153
  - Gemfile.lock
@@ -206,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
208
  - !ruby/object:Gem::Version
207
209
  version: '0'
208
210
  requirements: []
209
- rubygems_version: 3.0.3
211
+ rubygems_version: 3.1.4
210
212
  signing_key:
211
213
  specification_version: 4
212
214
  summary: GitLab metrics exporter