gitlab-exporter 13.2.0 → 13.3.1

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: 1faa75a67146917f990466c949a63cc5b53c4c4280bcaae76601071a88c5fb0c
4
- data.tar.gz: acd50e384eb4e03fdbf2ba20c8f030a47b886822a3e87cdddded7326790e5f25
3
+ metadata.gz: 5ffa16533118568301cba662228785262ac08d3fb58d85572b6a02199316732d
4
+ data.tar.gz: 26fe29073fb946867318bef4dd785653d6385ebd51fa8f8ae431bebab3daf3a8
5
5
  SHA512:
6
- metadata.gz: 6dbab1d6bce735e67ced073506ca2e9ddf1111ccd1b4a6e45a2289ce5a0ed069f5f004c2cda272a298d6328f7fe0fbd96cff30d434c722f01c1f1448b49199ce
7
- data.tar.gz: c625442a214949794bad144d38a511c96161af0261380cac50f509f421c7da03c6549b94059451322c9f23498ca33ccc9ce528c02f4874357c79b21bf9486e04
6
+ metadata.gz: d422202e989b82e4222a6bcc6610a2d62421da260e4a8e014b40458778ea0a64f135afb02269bb6f3513cea4cbeb3c127d3b917c6152c9c46f4403b241896f0f
7
+ data.tar.gz: e2a470642b3f97b3d9e19007bfeb365af4abe4fe7a71079a5fdcccae31939fa7b786c24a0f580c5f9a27c52edbb6c052bcea6055df89403d2e5c673caef3ee7c
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
  variables:
10
- RUBY_VERSION: "2.7"
10
+ RUBY_VERSION: "3.2"
11
11
 
12
12
  stages:
13
13
  - test
@@ -43,7 +43,7 @@ rspec:
43
43
  before_script: *before_scripts
44
44
  parallel:
45
45
  matrix:
46
- - RUBY_VERSION: ["2.7", "3.0", "3.1", "3.2"]
46
+ - RUBY_VERSION: ["3.0", "3.1", "3.2"]
47
47
 
48
48
  rspec_integration:
49
49
  script:
@@ -55,7 +55,7 @@ rspec_integration:
55
55
  REDIS_URL: "redis://redis"
56
56
  parallel:
57
57
  matrix:
58
- - RUBY_VERSION: ["2.7", "3.0", "3.1", "3.2"]
58
+ - RUBY_VERSION: ["3.0", "3.1", "3.2"]
59
59
 
60
60
  rubocop:
61
61
  script:
data/.rubocop_todo.yml CHANGED
@@ -1,19 +1,35 @@
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 2023-09-25 18:54:37 UTC using RuboCop version 1.56.3.
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
9
  # Offense count: 1
10
- # Configuration parameters: Include.
10
+ # Configuration parameters: Severity, Include.
11
11
  # Include: **/*.gemspec
12
12
  Gemspec/RequiredRubyVersion:
13
13
  Exclude:
14
14
  - 'gitlab-exporter.gemspec'
15
15
 
16
+ # Offense count: 1
17
+ # This cop supports safe autocorrection (--autocorrect).
18
+ # Configuration parameters: EnforcedStyleAlignWith, Severity.
19
+ # SupportedStylesAlignWith: start_of_line, begin
20
+ Layout/BeginEndAlignment:
21
+ Exclude:
22
+ - 'lib/gitlab_exporter/git.rb'
23
+
24
+ # Offense count: 1
25
+ # This cop supports safe autocorrection (--autocorrect).
26
+ Layout/RescueEnsureAlignment:
27
+ Exclude:
28
+ - 'lib/gitlab_exporter/git.rb'
29
+
16
30
  # Offense count: 3
31
+ # This cop supports safe autocorrection (--autocorrect).
32
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
17
33
  Lint/AmbiguousBlockAssociation:
18
34
  Exclude:
19
35
  - 'spec/git_spec.rb'
@@ -27,38 +43,83 @@ Lint/MissingCopEnableDirective:
27
43
  - 'spec/git_process_proper_spec.rb'
28
44
 
29
45
  # Offense count: 1
30
- # Cop supports --auto-correct.
46
+ # This cop supports unsafe autocorrection (--autocorrect-all).
31
47
  Lint/NonDeterministicRequireOrder:
32
48
  Exclude:
33
49
  - 'spec/spec_helper.rb'
34
50
 
35
- # Offense count: 16
36
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
37
- # ExcludedMethods: refine
51
+ # Offense count: 17
52
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
53
+ # AllowedMethods: refine
38
54
  Metrics/BlockLength:
39
- Max: 349
55
+ Max: 285
40
56
 
41
- # Offense count: 1
42
- # Configuration parameters: IgnoredMethods.
57
+ # Offense count: 3
58
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
43
59
  Metrics/CyclomaticComplexity:
44
60
  Max: 8
45
61
 
46
62
  # Offense count: 1
47
- # Configuration parameters: IgnoredMethods.
63
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
48
64
  Metrics/PerceivedComplexity:
49
65
  Max: 9
50
66
 
67
+ # Offense count: 9
68
+ # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
69
+ # SupportedStyles: snake_case, normalcase, non_integer
70
+ # AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
71
+ Naming/VariableNumber:
72
+ Exclude:
73
+ - 'spec/database/row_count_spec.rb'
74
+
75
+ # Offense count: 16
76
+ # This cop supports safe autocorrection (--autocorrect).
77
+ # Configuration parameters: EnforcedStyle.
78
+ # SupportedStyles: separated, grouped
79
+ Style/AccessorGrouping:
80
+ Exclude:
81
+ - 'lib/gitlab_exporter/memstats/mapping.rb'
82
+
83
+ # Offense count: 8
84
+ # This cop supports unsafe autocorrection (--autocorrect-all).
85
+ Style/GlobalStdStream:
86
+ Exclude:
87
+ - 'lib/gitlab_exporter/cli.rb'
88
+ - 'spec/database/bloat_spec.rb'
89
+
51
90
  # Offense count: 1
52
- # Configuration parameters: EnforcedStyle, AllowModifiersOnSymbols.
53
- # SupportedStyles: inline, group
54
- Style/AccessModifierDeclarations:
91
+ # This cop supports unsafe autocorrection (--autocorrect-all).
92
+ # Configuration parameters: AllowedReceivers.
93
+ # AllowedReceivers: Thread.current
94
+ Style/HashEachMethods:
55
95
  Exclude:
56
96
  - 'lib/gitlab_exporter/util.rb'
57
97
 
98
+ # Offense count: 9
99
+ # Configuration parameters: AllowedMethods.
100
+ # AllowedMethods: respond_to_missing?
101
+ Style/OptionalBooleanParameter:
102
+ Exclude:
103
+ - 'lib/gitlab_exporter/prometheus.rb'
104
+ - 'lib/gitlab_exporter/sidekiq.rb'
105
+
106
+ # Offense count: 1
107
+ # This cop supports safe autocorrection (--autocorrect).
108
+ Style/RedundantRegexpEscape:
109
+ Exclude:
110
+ - 'lib/gitlab_exporter/git.rb'
111
+
58
112
  # Offense count: 2
59
- # Cop supports --auto-correct.
60
- # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
113
+ # This cop supports unsafe autocorrection (--autocorrect-all).
114
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
61
115
  # AllowedMethods: present?, blank?, presence, try, try!
62
116
  Style/SafeNavigation:
63
117
  Exclude:
64
118
  - 'lib/gitlab_exporter/database/base.rb'
119
+
120
+ # Offense count: 1
121
+ # This cop supports unsafe autocorrection (--autocorrect-all).
122
+ # Configuration parameters: Mode.
123
+ Style/StringConcatenation:
124
+ Exclude:
125
+ - 'lib/gitlab_exporter/database/row_count.rb'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.7
1
+ 3.2.2
data/Gemfile CHANGED
@@ -4,5 +4,5 @@ gemspec
4
4
 
5
5
  group :test do
6
6
  gem "rspec", "~>3.12"
7
- gem "rubocop", "~>0.42"
7
+ gem "rubocop", "~> 1.52"
8
8
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-exporter (13.2.0)
4
+ gitlab-exporter (13.3.1)
5
5
  connection_pool (= 2.2.5)
6
6
  faraday (~> 1.8.0)
7
7
  pg (= 1.5.3)
@@ -16,7 +16,8 @@ PATH
16
16
  GEM
17
17
  remote: https://rubygems.org/
18
18
  specs:
19
- ast (2.4.1)
19
+ ast (2.4.2)
20
+ base64 (0.1.1)
20
21
  connection_pool (2.2.5)
21
22
  diff-lcs (1.5.0)
22
23
  faraday (1.8.0)
@@ -38,26 +39,30 @@ GEM
38
39
  faraday-net_http_persistent (1.2.0)
39
40
  faraday-patron (1.0.0)
40
41
  faraday-rack (1.0.0)
42
+ json (2.6.3)
43
+ language_server-protocol (3.17.0.3)
41
44
  multipart-post (2.2.3)
42
45
  mustermann (2.0.2)
43
46
  ruby2_keywords (~> 0.0.1)
44
47
  nio4r (2.5.8)
45
- parallel (1.20.1)
46
- parser (3.0.0.0)
48
+ parallel (1.23.0)
49
+ parser (3.2.2.3)
47
50
  ast (~> 2.4.1)
51
+ racc
48
52
  pg (1.5.3)
49
53
  puma (5.6.5)
50
54
  nio4r (~> 2.0)
51
55
  quantile (0.2.1)
56
+ racc (1.7.1)
52
57
  rack (2.2.5)
53
58
  rack-protection (2.2.4)
54
59
  rack
55
- rainbow (3.0.0)
60
+ rainbow (3.1.1)
56
61
  redis (4.4.0)
57
62
  redis-namespace (1.9.0)
58
63
  redis (>= 4)
59
- regexp_parser (2.0.3)
60
- rexml (3.2.4)
64
+ regexp_parser (2.8.1)
65
+ rexml (3.2.6)
61
66
  rspec (3.12.0)
62
67
  rspec-core (~> 3.12.0)
63
68
  rspec-expectations (~> 3.12.0)
@@ -71,18 +76,21 @@ GEM
71
76
  diff-lcs (>= 1.2.0, < 2.0)
72
77
  rspec-support (~> 3.12.0)
73
78
  rspec-support (3.12.0)
74
- rubocop (0.93.1)
79
+ rubocop (1.56.3)
80
+ base64 (~> 0.1.1)
81
+ json (~> 2.3)
82
+ language_server-protocol (>= 3.17.0)
75
83
  parallel (~> 1.10)
76
- parser (>= 2.7.1.5)
84
+ parser (>= 3.2.2.3)
77
85
  rainbow (>= 2.2.2, < 4.0)
78
- regexp_parser (>= 1.8)
79
- rexml
80
- rubocop-ast (>= 0.6.0)
86
+ regexp_parser (>= 1.8, < 3.0)
87
+ rexml (>= 3.2.5, < 4.0)
88
+ rubocop-ast (>= 1.28.1, < 2.0)
81
89
  ruby-progressbar (~> 1.7)
82
- unicode-display_width (>= 1.4.0, < 2.0)
83
- rubocop-ast (1.4.0)
84
- parser (>= 2.7.1.5)
85
- ruby-progressbar (1.11.0)
90
+ unicode-display_width (>= 2.4.0, < 3.0)
91
+ rubocop-ast (1.29.0)
92
+ parser (>= 3.2.1.0)
93
+ ruby-progressbar (1.13.0)
86
94
  ruby2_keywords (0.0.5)
87
95
  sidekiq (6.4.0)
88
96
  connection_pool (>= 2.2.2)
@@ -94,7 +102,7 @@ GEM
94
102
  rack-protection (= 2.2.4)
95
103
  tilt (~> 2.0)
96
104
  tilt (2.0.11)
97
- unicode-display_width (1.7.0)
105
+ unicode-display_width (2.4.2)
98
106
  webrick (1.7.0)
99
107
 
100
108
  PLATFORMS
@@ -104,7 +112,7 @@ DEPENDENCIES
104
112
  gitlab-exporter!
105
113
  rspec (~> 3.12)
106
114
  rspec-expectations (~> 3.12.0)
107
- rubocop (~> 0.42)
115
+ rubocop (~> 1.52)
108
116
 
109
117
  BUNDLED WITH
110
118
  2.4.5
@@ -10,6 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.description = "GitLab metrics exporter to use with prometheus"
11
11
  s.authors = ["Pablo Carranza"]
12
12
  s.email = "pablo@gitlab.com"
13
+ s.required_ruby_version = ">= 3.0.0"
13
14
 
14
15
  s.files = `git ls-files -z`.split("\x0")
15
16
 
@@ -1,19 +1,5 @@
1
1
  require "yaml"
2
2
 
3
- # TODO: Remove this once we're on Ruby 3
4
- # https://gitlab.com/gitlab-org/gitlab/-/issues/393651
5
- unless YAML.respond_to?(:safe_load_file)
6
- module YAML # rubocop:disable Style/Documentation
7
- # Temporary Ruby 2 back-compat workaround.
8
- #
9
- # This method only exists as of stdlib 3.0.0:
10
- # https://ruby-doc.org/stdlib-3.0.0/libdoc/psych/rdoc/Psych.html
11
- def self.safe_load_file(path, **options)
12
- YAML.safe_load(File.read(path), **options)
13
- end
14
- end
15
- end
16
-
17
3
  module GitLab
18
4
  module Exporter
19
5
  # Stores runner classes in a single place
@@ -23,6 +23,9 @@ module GitLab
23
23
  # needed to be re-initialized
24
24
  POOL_TIMEOUT = 90
25
25
 
26
+ # Lock for Sidekiq.redis which we need to modify, but is not concurrency safe.
27
+ SIDEKIQ_REDIS_LOCK = Mutex.new
28
+
26
29
  PrometheusMetrics.describe("sidekiq_enqueued_jobs",
27
30
  "Total number of jobs enqueued by class name. Only inspects the first #{PROBE_JOBS_LIMIT} jobs per queue.") # rubocop:disable Layout/LineLength
28
31
 
@@ -211,16 +214,15 @@ module GitLab
211
214
  end
212
215
 
213
216
  def with_sidekiq(namespaced = true)
214
- # TODO: this is not concurrent safe as we change global context
215
- # It means that we are unable to use many different sidekiq's
216
- # which is not a problem as of now
217
- Sidekiq.configure_client do |config|
218
- config.redis = self.class.connection_pool[redis_options(namespaced)]
219
- end
217
+ SIDEKIQ_REDIS_LOCK.synchronize {
218
+ Sidekiq.configure_client do |config|
219
+ config.redis = self.class.connection_pool[redis_options(namespaced)]
220
+ end
220
221
 
221
- return unless connected?
222
+ return unless connected?
222
223
 
223
- yield
224
+ yield
225
+ }
224
226
  end
225
227
 
226
228
  def redis_options(namespaced = true)
@@ -1,5 +1,5 @@
1
1
  module GitLab
2
2
  module Exporter
3
- VERSION = "13.2.0".freeze
3
+ VERSION = "13.3.1".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-exporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.2.0
4
+ version: 13.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pablo Carranza
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2016-07-27 00:00:00.000000000 Z
@@ -242,7 +242,7 @@ homepage: http://gitlab.com
242
242
  licenses:
243
243
  - MIT
244
244
  metadata: {}
245
- post_install_message:
245
+ post_install_message:
246
246
  rdoc_options: []
247
247
  require_paths:
248
248
  - lib
@@ -250,15 +250,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
250
250
  requirements:
251
251
  - - ">="
252
252
  - !ruby/object:Gem::Version
253
- version: '0'
253
+ version: 3.0.0
254
254
  required_rubygems_version: !ruby/object:Gem::Requirement
255
255
  requirements:
256
256
  - - ">="
257
257
  - !ruby/object:Gem::Version
258
258
  version: '0'
259
259
  requirements: []
260
- rubygems_version: 3.1.6
261
- signing_key:
260
+ rubygems_version: 3.4.10
261
+ signing_key:
262
262
  specification_version: 4
263
263
  summary: GitLab metrics exporter
264
264
  test_files: