gitlab-exporter 16.0.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: 9238e8cac6cf2f3ef7988d072cd7a2e2398e0304af9920fa66200965f1c4b98c
4
- data.tar.gz: 6a99535403821e1b5acd5a1b9d46be11a6e97f2b6f8e1c99682faacb733ea847
3
+ metadata.gz: f8f9e18ad6f1758709b718bb67c3491f654a01078aa7835462a0e346731adff9
4
+ data.tar.gz: affa763080262ed9621f7d51f8342aaebb2ca8cd5f6296b730a02a042d62b816
5
5
  SHA512:
6
- metadata.gz: 9adc56ffd8bb27659d37145b55a96eac0f8a905057ef938568054426c68f7d9693dd38915cd50467d6dd4d58e97c25210630fa2ce1e491096b07ed01e7ef6523
7
- data.tar.gz: ea57211fc8eb131f13b30db56bf014363440effecd9d5ccd21e9e298116b7ee9e90ea7c1c08f91aa53198599840daa99a0b57261d926fa1ce5e28538be18c84e
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: "3.0"
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:
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/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,15 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-exporter (16.0.0)
4
+ gitlab-exporter (16.1.0)
5
5
  connection_pool (= 2.5.3)
6
6
  deep_merge (~> 1.2.2)
7
- faraday (= 2.13.3)
8
- pg (= 1.5.9)
9
- puma (= 6.6.0)
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
14
  sinatra (~> 3.2.0)
15
15
  webrick (~> 1.9)
@@ -17,38 +17,42 @@ PATH
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
22
  connection_pool (2.5.3)
23
23
  deep_merge (1.2.2)
24
24
  diff-lcs (1.5.0)
25
- faraday (2.13.3)
25
+ faraday (2.13.4)
26
26
  faraday-net_http (>= 2.0, < 3.5)
27
27
  json
28
28
  logger
29
29
  faraday-net_http (3.0.2)
30
30
  json (2.13.2)
31
+ language_server-protocol (3.17.0.5)
32
+ lint_roller (1.1.0)
31
33
  logger (1.7.0)
32
34
  mustermann (3.0.3)
33
35
  ruby2_keywords (~> 0.0.1)
34
36
  nio4r (2.7.4)
35
- parallel (1.20.1)
36
- parser (3.0.0.0)
37
+ parallel (1.27.0)
38
+ parser (3.3.9.0)
37
39
  ast (~> 2.4.1)
38
- pg (1.5.9)
39
- puma (6.6.0)
40
+ racc
41
+ pg (1.6.1)
42
+ prism (1.4.0)
43
+ puma (6.6.1)
40
44
  nio4r (~> 2.0)
41
45
  quantile (0.2.1)
46
+ racc (1.8.1)
42
47
  rack (2.2.15)
43
48
  rack-protection (3.2.0)
44
49
  base64 (>= 0.1.0)
45
50
  rack (~> 2.2, >= 2.2.4)
46
- rainbow (3.0.0)
47
- redis (4.5.0)
48
- redis-namespace (1.9.0)
51
+ rainbow (3.1.1)
52
+ redis (4.8.1)
53
+ redis-namespace (1.11.0)
49
54
  redis (>= 4)
50
- regexp_parser (2.0.3)
51
- rexml (3.2.4)
55
+ regexp_parser (2.11.0)
52
56
  rspec (3.12.0)
53
57
  rspec-core (~> 3.12.0)
54
58
  rspec-expectations (~> 3.12.0)
@@ -62,18 +66,21 @@ GEM
62
66
  diff-lcs (>= 1.2.0, < 2.0)
63
67
  rspec-support (~> 3.12.0)
64
68
  rspec-support (3.12.0)
65
- 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)
66
73
  parallel (~> 1.10)
67
- parser (>= 2.7.1.5)
74
+ parser (>= 3.3.0.2)
68
75
  rainbow (>= 2.2.2, < 4.0)
69
- regexp_parser (>= 1.8)
70
- rexml
71
- rubocop-ast (>= 0.6.0)
76
+ regexp_parser (>= 2.9.3, < 3.0)
77
+ rubocop-ast (>= 1.46.0, < 2.0)
72
78
  ruby-progressbar (~> 1.7)
73
- unicode-display_width (>= 1.4.0, < 2.0)
74
- rubocop-ast (1.4.0)
75
- parser (>= 2.7.1.5)
76
- 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)
77
84
  ruby2_keywords (0.0.5)
78
85
  sidekiq (6.5.12)
79
86
  connection_pool (>= 2.2.5, < 3)
@@ -85,7 +92,9 @@ GEM
85
92
  rack-protection (= 3.2.0)
86
93
  tilt (~> 2.0)
87
94
  tilt (2.6.0)
88
- 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)
89
98
  webrick (1.9.1)
90
99
 
91
100
  PLATFORMS
@@ -93,9 +102,9 @@ PLATFORMS
93
102
 
94
103
  DEPENDENCIES
95
104
  gitlab-exporter!
96
- rspec (~> 3.12)
105
+ rspec (~> 3.12.0)
97
106
  rspec-expectations (~> 3.12.0)
98
- rubocop (~> 0.42)
107
+ rubocop (~> 1.0)
99
108
 
100
109
  BUNDLED WITH
101
- 2.4.20
110
+ 2.7.1
@@ -24,12 +24,12 @@ Gem::Specification.new do |s|
24
24
 
25
25
  s.add_runtime_dependency "connection_pool", "2.5.3"
26
26
  s.add_runtime_dependency "deep_merge", "~> 1.2.2"
27
- s.add_runtime_dependency "faraday", "2.13.3"
28
- s.add_runtime_dependency "pg", "1.5.9"
29
- s.add_runtime_dependency "puma", "6.6.0"
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
34
  s.add_runtime_dependency "sinatra", "~> 3.2.0"
35
35
  s.add_runtime_dependency "webrick", "~> 1.9"
@@ -44,7 +44,7 @@ module GitLab
44
44
  @options = options(args)
45
45
  args = @options.parse!
46
46
  @source = args.shift
47
- @target = args.shift || STDOUT
47
+ @target = args.shift || $stdout
48
48
  @labels ||= {}
49
49
  end
50
50
 
@@ -79,7 +79,7 @@ module GitLab
79
79
 
80
80
  # Database tuple stats runner.
81
81
  #
82
- # 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
83
83
  class DatabaseTupleStats
84
84
  COMMAND_NAME = "db-tuple-stats".freeze
85
85
 
@@ -87,7 +87,7 @@ module GitLab
87
87
  @options = options(args)
88
88
  @options.parse!
89
89
 
90
- @target = args.shift || STDOUT
90
+ @target = args.shift || $stdout
91
91
  @target = File.open(@target, "a") if @target.is_a?(String)
92
92
  end
93
93
 
@@ -121,7 +121,7 @@ module GitLab
121
121
 
122
122
  # Database row counts query runner.
123
123
  #
124
- # 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
125
125
  class DatabaseRowCounts
126
126
  COMMAND_NAME = "row-counts".freeze
127
127
 
@@ -129,7 +129,7 @@ module GitLab
129
129
  @options = options(args)
130
130
  @options.parse!
131
131
 
132
- @target = args.shift || STDOUT
132
+ @target = args.shift || $stdout
133
133
  @target = File.open(@target, "a") if @target.is_a?(String)
134
134
  end
135
135
 
@@ -234,7 +234,7 @@ module GitLab
234
234
  @options = options(args)
235
235
  @options.parse!
236
236
 
237
- @target = args.shift || STDOUT
237
+ @target = args.shift || $stdout
238
238
  @target = File.open(@target, "a") if @target.is_a?(String)
239
239
  end
240
240
 
@@ -271,7 +271,7 @@ module GitLab
271
271
 
272
272
  # Sidekiq runner.
273
273
  #
274
- # 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
275
275
  class SidekiqRunner
276
276
  COMMAND_NAME = "sidekiq".freeze
277
277
 
@@ -279,7 +279,7 @@ module GitLab
279
279
  @options = options(args)
280
280
  @options.parse!
281
281
 
282
- @target = args.shift || STDOUT
282
+ @target = args.shift || $stdout
283
283
  @target = File.open(@target, "a") if @target.is_a?(String)
284
284
  end
285
285
 
@@ -315,7 +315,7 @@ module GitLab
315
315
  redis_sentinels: @redis_sentinels,
316
316
  redis_sentinel_username: @redis_sentinel_username,
317
317
  redis_sentinel_password: @redis_sentinel_password,
318
- logger: Logger.new(STDERR))
318
+ logger: Logger.new($stderr))
319
319
 
320
320
  prober
321
321
  .probe_stats
@@ -343,7 +343,7 @@ module GitLab
343
343
  @options = options(args)
344
344
  @options.parse!
345
345
 
346
- @target = args.shift || STDOUT
346
+ @target = args.shift || $stdout
347
347
  @target = File.open(@target, "a") if @target.is_a?(String)
348
348
  end
349
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 = "16.0.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: 16.0.0
4
+ version: 16.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pablo Carranza
@@ -44,42 +44,42 @@ dependencies:
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 2.13.3
47
+ version: 2.13.4
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 2.13.3
54
+ version: 2.13.4
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pg
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 1.5.9
61
+ version: 1.6.1
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: 1.5.9
68
+ version: 1.6.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: puma
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 6.6.0
75
+ version: 6.6.1
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: 6.6.0
82
+ version: 6.6.1
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: quantile
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -100,28 +100,28 @@ dependencies:
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 4.5.0
103
+ version: 4.8.1
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: 4.5.0
110
+ version: 4.8.1
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: redis-namespace
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 1.9.0
117
+ version: 1.11.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 1.9.0
124
+ version: 1.11.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: sidekiq
127
127
  requirement: !ruby/object:Gem::Requirement