gitlab-exporter 7.0.6 → 7.1.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: 5f44f68c2a2d894b29ec2c891e0b6af0248ddaa2cb2ffe2c972c5ce08dd8de2e
4
- data.tar.gz: 44156a1741197ac6da5db3ddd9a85c839b0c969e73edde7e723edcdd6b9b5b3e
3
+ metadata.gz: 2590101193dd650767c1f39170beb0b54661c188b7c1222fa7d01d59ee1f442a
4
+ data.tar.gz: 9237f257766fefe33cf0e398a86d44ecae609a393c046c7e5203b07a74adaca4
5
5
  SHA512:
6
- metadata.gz: f031bc1502b34f26690cd009d24f3d3f0c0e18cdd1167a21b9e8f6a135c24927f229ac0a7214cdd633943b8d9d588e8f1e8ff0cdba75a3b2f0474fdaf260d8ed
7
- data.tar.gz: e267adae77f66e5470cc7d60485d249bc3bb692e54380b0cfd5dd6b552a769ec0ea9147ef4bcca8c3d27bba0e37027c367a5125d2e86c98b74419ad11c0dba34
6
+ metadata.gz: 4109296df37f483e64b5c3f9c9da8ce6359a8b36cbb8b2bc7a40c3147ee0401fafee78829b6e67e43167b1a859d771669e6f94e85f7ebf8529a7bbea45be6431
7
+ data.tar.gz: e4d05c4fad006d5a27f693887320b6f2a633f96b1109e97f7e89f5b990d695528b72ef2e7b876901d520df3f4be6c6b24850208228923c227443e06b70b81988
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-exporter (7.0.6)
4
+ gitlab-exporter (7.1.0)
5
5
  connection_pool (~> 2.2.1)
6
6
  pg (~> 1.1)
7
7
  quantile (~> 0.2.0)
@@ -14,19 +14,20 @@ GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
16
  ast (2.4.0)
17
- connection_pool (2.2.2)
17
+ connection_pool (2.2.3)
18
18
  diff-lcs (1.3)
19
- mustermann (1.0.3)
19
+ mustermann (1.1.1)
20
+ ruby2_keywords (~> 0.0.1)
20
21
  parser (2.5.1.0)
21
22
  ast (~> 2.4.0)
22
- pg (1.2.2)
23
+ pg (1.2.3)
23
24
  powerpack (0.1.1)
24
25
  quantile (0.2.1)
25
- rack (2.0.7)
26
- rack-protection (2.0.7)
26
+ rack (2.2.3)
27
+ rack-protection (2.0.8.1)
27
28
  rack
28
29
  rainbow (2.1.0)
29
- redis (4.1.3)
30
+ redis (4.1.4)
30
31
  redis-namespace (1.6.0)
31
32
  redis (>= 3.0.4)
32
33
  rspec (3.7.0)
@@ -49,17 +50,18 @@ GEM
49
50
  ruby-progressbar (~> 1.7)
50
51
  unicode-display_width (~> 1.0, >= 1.0.1)
51
52
  ruby-progressbar (1.8.1)
52
- sidekiq (5.2.7)
53
+ ruby2_keywords (0.0.2)
54
+ sidekiq (5.2.9)
53
55
  connection_pool (~> 2.2, >= 2.2.2)
54
- rack (>= 1.5.0)
56
+ rack (~> 2.0)
55
57
  rack-protection (>= 1.5.0)
56
- redis (>= 3.3.5, < 5)
57
- sinatra (2.0.7)
58
+ redis (>= 3.3.5, < 4.2)
59
+ sinatra (2.0.8.1)
58
60
  mustermann (~> 1.0)
59
61
  rack (~> 2.0)
60
- rack-protection (= 2.0.7)
62
+ rack-protection (= 2.0.8.1)
61
63
  tilt (~> 2.0)
62
- tilt (2.0.9)
64
+ tilt (2.0.10)
63
65
  unicode-display_width (1.6.0)
64
66
 
65
67
  PLATFORMS
@@ -16,8 +16,9 @@ module GitLab
16
16
  end
17
17
  end
18
18
 
19
- def initialize(args)
19
+ def initialize(args, logger: nil)
20
20
  @connection_string = args[:connection_string]
21
+ @logger = logger
21
22
  end
22
23
 
23
24
  def run
@@ -33,10 +34,14 @@ module GitLab
33
34
  begin
34
35
  yield conn
35
36
  rescue PG::UnableToSend => e
37
+ @logger.warn "Error sending to the database: #{e}" if @logger
36
38
  conn.reset
37
39
  raise e
38
40
  end
39
41
  end
42
+ rescue PG::Error => e
43
+ @logger.error "Error connecting to the database: #{e}" if @logger
44
+ raise e
40
45
  end
41
46
  end
42
47
  end
@@ -262,8 +262,8 @@ module GitLab
262
262
 
263
263
  DEFAULT_UNARCHIVED_TRACES_OFFSET_MINUTES = 1440
264
264
 
265
- def initialize(opts)
266
- super(opts)
265
+ def initialize(opts, logger: nil)
266
+ super(opts, logger: logger)
267
267
 
268
268
  @allowed_repeated_commands_count = opts[:allowed_repeated_commands_count]
269
269
  @created_builds_counting_disabled = opts[:created_builds_counting_disabled]
@@ -417,14 +417,14 @@ module GitLab
417
417
 
418
418
  # The prober which is called when gathering metrics
419
419
  class CiBuildsProber
420
- def initialize(opts, metrics: PrometheusMetrics.new)
420
+ def initialize(opts, metrics: PrometheusMetrics.new, logger: nil)
421
421
  @metrics = metrics
422
422
 
423
423
  collector_opts = { connection_string: opts[:connection_string],
424
424
  allowed_repeated_commands_count: opts[:allowed_repeated_commands_count],
425
425
  created_builds_counting_disabled: opts[:created_builds_counting_disabled],
426
426
  unarchived_traces_offset_minutes: opts[:unarchived_traces_offset_minutes] }
427
- @collector = CiBuildsCollector.new(collector_opts)
427
+ @collector = CiBuildsCollector.new(collector_opts, logger: logger)
428
428
  end
429
429
 
430
430
  def probe_db
@@ -35,7 +35,7 @@ module GitLab
35
35
 
36
36
  # The prober which is called when gathering metrics
37
37
  class RemoteMirrorsProber
38
- def initialize(opts, metrics: PrometheusMetrics.new)
38
+ def initialize(opts, metrics: PrometheusMetrics.new, logger: nil) # rubocop:disable Lint/UnusedMethodArgument
39
39
  @metrics = metrics
40
40
  @collector = RemoteMirrorsCollector.new(
41
41
  connection_string: opts[:connection_string],
@@ -212,7 +212,7 @@ module GitLab
212
212
 
213
213
  # The prober which is called when gathering metrics
214
214
  class RowCountProber
215
- def initialize(opts, metrics: PrometheusMetrics.new)
215
+ def initialize(opts, metrics: PrometheusMetrics.new, logger: nil) # rubocop:disable Lint/UnusedMethodArgument
216
216
  @metrics = metrics
217
217
  @collector = RowCountCollector.new(
218
218
  connection_string: opts[:connection_string],
@@ -25,9 +25,9 @@ module GitLab
25
25
 
26
26
  # Probes the DB specified by opts[:connection_string] for tuple stats, then converts them to metrics
27
27
  class TuplesProber
28
- def initialize(opts, metrics: PrometheusMetrics.new)
28
+ def initialize(opts, metrics: PrometheusMetrics.new, logger: nil)
29
29
  @metrics = metrics
30
- @collector = TupleStatsCollector.new(connection_string: opts[:connection_string])
30
+ @collector = TupleStatsCollector.new(connection_string: opts[:connection_string], logger: logger)
31
31
  end
32
32
 
33
33
  def probe_db
@@ -62,7 +62,7 @@ module GitLab
62
62
  # Optionally takes a metrics object which by default is a PrometheusMetrics, useful to change the
63
63
  # metrics writer to something else.
64
64
  class GitProber
65
- def initialize(opts, metrics: PrometheusMetrics.new)
65
+ def initialize(opts, metrics: PrometheusMetrics.new, logger: nil) # rubocop:disable Lint/UnusedMethodArgument
66
66
  @metrics = metrics
67
67
  @labels = opts[:labels] || {}
68
68
  @git = Git.new(opts[:source])
@@ -85,7 +85,7 @@ module GitLab
85
85
 
86
86
  # A special prober for git processes
87
87
  class GitProcessProber
88
- def initialize(opts, metrics: PrometheusMetrics.new)
88
+ def initialize(opts, metrics: PrometheusMetrics.new, logger: nil) # rubocop:disable Lint/UnusedMethodArgument
89
89
  @opts = opts
90
90
  @metrics = metrics
91
91
  end
@@ -2,9 +2,10 @@ module GitLab
2
2
  module Exporter
3
3
  # A class to combine multiple probers into one
4
4
  class Prober
5
- def initialize(prober_opts, metrics: PrometheusMetrics.new)
5
+ def initialize(prober_opts, metrics: PrometheusMetrics.new, logger: nil)
6
6
  @prober_opts = prober_opts
7
7
  @metrics = metrics
8
+ @logger = logger
8
9
 
9
10
  resolve_prober_classes
10
11
  end
@@ -12,7 +13,7 @@ module GitLab
12
13
  def probe_all
13
14
  @prober_opts.each do |_probe_name, params|
14
15
  Utils.wrap_in_array(params[:opts]).each do |opts|
15
- prober = params[:class].new(opts, metrics: @metrics)
16
+ prober = params[:class].new(opts, metrics: @metrics, logger: @logger)
16
17
  params[:methods].each do |meth|
17
18
  prober.send(meth)
18
19
  end
@@ -59,7 +59,7 @@ module GitLab
59
59
 
60
60
  # Probes a process for info then writes metrics to a target
61
61
  class ProcessProber
62
- def initialize(options, metrics: PrometheusMetrics.new)
62
+ def initialize(options, metrics: PrometheusMetrics.new, logger: nil) # rubocop:disable Lint/UnusedMethodArgument
63
63
  @metrics = metrics
64
64
  @name = options[:name]
65
65
  @pids = if options[:pid_or_pattern] =~ /^\d+$/
@@ -10,9 +10,10 @@ module GitLab
10
10
  QUEUE_JOB_STATS_SCRIPT = File.read(File.expand_path("#{__FILE__}/../sidekiq_queue_job_stats.lua")).freeze
11
11
  QUEUE_JOB_STATS_SHA = Digest::SHA1.hexdigest(QUEUE_JOB_STATS_SCRIPT).freeze
12
12
 
13
- def initialize(opts, metrics: PrometheusMetrics.new)
13
+ def initialize(opts, metrics: PrometheusMetrics.new, logger: nil)
14
14
  @opts = opts
15
15
  @metrics = metrics
16
+ @logger = logger
16
17
 
17
18
  Sidekiq.configure_client do |config|
18
19
  config.redis = redis_options
@@ -1,5 +1,5 @@
1
1
  module GitLab
2
2
  module Exporter
3
- VERSION = "7.0.6".freeze
3
+ VERSION = "7.1.0".freeze
4
4
  end
5
5
  end
@@ -42,6 +42,11 @@ module GitLab
42
42
 
43
43
  memory_threshold = (config[:server] && config[:server][:memory_threshold]) || 1024
44
44
  use MemoryKillerMiddleware, memory_threshold
45
+ use Rack::Logger
46
+ end
47
+
48
+ def logger
49
+ request.logger
45
50
  end
46
51
 
47
52
  def setup_server(config)
@@ -62,7 +67,7 @@ module GitLab
62
67
 
63
68
  get "/#{probe_name}" do
64
69
  content_type "text/plain; version=0.0.4"
65
- prober = Prober.new(opts, metrics: PrometheusMetrics.new(include_timestamp: false))
70
+ prober = Prober.new(opts, metrics: PrometheusMetrics.new(include_timestamp: false), logger: logger)
66
71
 
67
72
  prober.probe_all
68
73
  prober.write_to(response)
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: 7.0.6
4
+ version: 7.1.0
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
@@ -191,7 +191,7 @@ homepage: http://gitlab.com
191
191
  licenses:
192
192
  - MIT
193
193
  metadata: {}
194
- post_install_message:
194
+ post_install_message:
195
195
  rdoc_options: []
196
196
  require_paths:
197
197
  - lib
@@ -207,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
207
  version: '0'
208
208
  requirements: []
209
209
  rubygems_version: 3.0.3
210
- signing_key:
210
+ signing_key:
211
211
  specification_version: 4
212
212
  summary: GitLab metrics exporter
213
213
  test_files: