gitlab-exporter 7.0.4 → 7.1.2
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 +4 -4
- data/.gitlab-ci.yml +25 -5
- data/Gemfile.lock +6 -6
- data/lib/gitlab_exporter/database/base.rb +6 -1
- data/lib/gitlab_exporter/database/bloat.rb +5 -1
- data/lib/gitlab_exporter/database/ci_builds.rb +15 -18
- data/lib/gitlab_exporter/database/remote_mirrors.rb +1 -1
- data/lib/gitlab_exporter/database/row_count.rb +10 -4
- data/lib/gitlab_exporter/database/tuple_stats.rb +2 -2
- data/lib/gitlab_exporter/git.rb +2 -2
- data/lib/gitlab_exporter/prober.rb +3 -2
- data/lib/gitlab_exporter/process.rb +1 -1
- data/lib/gitlab_exporter/sidekiq.rb +2 -1
- data/lib/gitlab_exporter/version.rb +1 -1
- data/lib/gitlab_exporter/web_exporter.rb +6 -1
- data/spec/database/bloat_spec.rb +5 -1
- data/spec/database/ci_builds_spec.rb +4 -4
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 350884c8d1f03a58cad2630e0076aa641d22d60aed65a5d2342cb7f4508ec655
|
4
|
+
data.tar.gz: d1857b8e6a8f842b438d12810c110ff4b8bbdf5226b5a6c5859dd949c12d1dd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b62aaf4f95b4da82b1e5bc86058b97c363a1b43ae7026589e30da6af47ccf69261ec279094574927180b270be358afbba8304d10bff3fe8fb047fb54b6be538
|
7
|
+
data.tar.gz: 34d27b77c5b04c4a079d184ff30db9b75f37471f9ac0e5199790ce550ee360e52d6f81d2b22b6f159a780ff7525b866b79f8ab0c06265d6251f697177b86fc83
|
data/.gitlab-ci.yml
CHANGED
@@ -1,17 +1,26 @@
|
|
1
|
+
include:
|
2
|
+
- template: Security/DAST.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab-foss/blob/master/lib/gitlab/ci/templates/Security/DAST.gitlab-ci.yml
|
3
|
+
- template: Security/Container-Scanning.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab-foss/blob/master/lib/gitlab/ci/templates/Security/Container-Scanning.gitlab-ci.yml
|
4
|
+
- 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
|
5
|
+
- template: Security/License-Scanning.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab-foss/blob/master/lib/gitlab/ci/templates/Security/License-Scanning.gitlab-ci.yml
|
6
|
+
- template: Security/SAST.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab-foss/blob/master/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml
|
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
|
+
|
1
9
|
default:
|
2
10
|
image: "ruby:2.3"
|
3
|
-
before_script:
|
4
|
-
- git config --global user.email "bot@gitlab.com"
|
5
|
-
- git config --global user.name "Bot User"
|
6
|
-
- bundle install -j $(nproc) --path vendor
|
7
11
|
cache:
|
8
12
|
paths:
|
9
13
|
- vendor
|
10
14
|
tags:
|
11
15
|
- gitlab-org
|
12
16
|
|
17
|
+
.before_scripts: &before_scripts
|
18
|
+
- git config --global user.email "bot@gitlab.com"
|
19
|
+
- git config --global user.name "Bot User"
|
20
|
+
- bundle install -j $(nproc) --path vendor
|
21
|
+
|
13
22
|
workflow:
|
14
|
-
rules:
|
23
|
+
rules: &workflow_rules
|
15
24
|
# For merge requests, create a pipeline.
|
16
25
|
- if: '$CI_MERGE_REQUEST_IID'
|
17
26
|
# For `master` branch, create a pipeline (this includes on schedules, pushes, merges, etc.).
|
@@ -22,7 +31,18 @@ workflow:
|
|
22
31
|
rspec:
|
23
32
|
script:
|
24
33
|
- bundle exec rspec spec -f d -c
|
34
|
+
before_script: *before_scripts
|
25
35
|
|
26
36
|
rubocop:
|
27
37
|
script:
|
28
38
|
- bundle exec rubocop
|
39
|
+
before_script: *before_scripts
|
40
|
+
|
41
|
+
license_scanning:
|
42
|
+
rules: *workflow_rules
|
43
|
+
|
44
|
+
gemnasium-dependency_scanning:
|
45
|
+
rules: *workflow_rules
|
46
|
+
|
47
|
+
secret_detection:
|
48
|
+
rules: *workflow_rules
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gitlab-exporter (7.
|
4
|
+
gitlab-exporter (7.1.2)
|
5
5
|
connection_pool (~> 2.2.1)
|
6
6
|
pg (~> 1.1)
|
7
7
|
quantile (~> 0.2.0)
|
@@ -14,7 +14,7 @@ GEM
|
|
14
14
|
remote: https://rubygems.org/
|
15
15
|
specs:
|
16
16
|
ast (2.4.0)
|
17
|
-
connection_pool (2.2.
|
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)
|
@@ -23,7 +23,7 @@ GEM
|
|
23
23
|
pg (1.2.3)
|
24
24
|
powerpack (0.1.1)
|
25
25
|
quantile (0.2.1)
|
26
|
-
rack (2.
|
26
|
+
rack (2.2.3)
|
27
27
|
rack-protection (2.0.8.1)
|
28
28
|
rack
|
29
29
|
rainbow (2.1.0)
|
@@ -51,11 +51,11 @@ GEM
|
|
51
51
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
52
52
|
ruby-progressbar (1.8.1)
|
53
53
|
ruby2_keywords (0.0.2)
|
54
|
-
sidekiq (5.2.
|
54
|
+
sidekiq (5.2.9)
|
55
55
|
connection_pool (~> 2.2, >= 2.2.2)
|
56
|
-
rack (
|
56
|
+
rack (~> 2.0)
|
57
57
|
rack-protection (>= 1.5.0)
|
58
|
-
redis (>= 3.3.5, <
|
58
|
+
redis (>= 3.3.5, < 4.2)
|
59
59
|
sinatra (2.0.8.1)
|
60
60
|
mustermann (~> 1.0)
|
61
61
|
rack (~> 2.0)
|
@@ -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
|
@@ -3,6 +3,8 @@ module GitLab
|
|
3
3
|
module Database
|
4
4
|
# Helper to collect bloat metrics.
|
5
5
|
class BloatCollector < Base
|
6
|
+
attr_writer :logger
|
7
|
+
|
6
8
|
def run(type = :btree)
|
7
9
|
execute(self.class.query_for(type)).each_with_object({}) do |row, h|
|
8
10
|
h[row["object_name"]] = row
|
@@ -39,9 +41,11 @@ module GitLab
|
|
39
41
|
|
40
42
|
def initialize(opts,
|
41
43
|
metrics: PrometheusMetrics.new,
|
42
|
-
collector: BloatCollector.new(connection_string: opts[:connection_string])
|
44
|
+
collector: BloatCollector.new(connection_string: opts[:connection_string]),
|
45
|
+
logger: nil)
|
43
46
|
@metrics = metrics
|
44
47
|
@collector = collector
|
48
|
+
@collector.logger = logger
|
45
49
|
@bloat_types = opts[:bloat_types] || %i(btree table)
|
46
50
|
end
|
47
51
|
|
@@ -21,8 +21,7 @@ module GitLab
|
|
21
21
|
ON namespaces.id = projects.namespace_id
|
22
22
|
LEFT JOIN namespace_statistics
|
23
23
|
ON namespace_statistics.namespace_id = namespaces.id
|
24
|
-
JOIN application_settings
|
25
|
-
ON application_settings.id = 1
|
24
|
+
JOIN application_settings ON (TRUE)
|
26
25
|
WHERE ci_builds.type = 'Ci::Build'
|
27
26
|
AND ci_builds.status = '%s'
|
28
27
|
-- The created_at filter has been introduced for performance reasons only
|
@@ -95,8 +94,7 @@ module GitLab
|
|
95
94
|
ON namespaces.id = projects.namespace_id
|
96
95
|
LEFT JOIN namespace_statistics
|
97
96
|
ON namespace_statistics.namespace_id = namespaces.id
|
98
|
-
JOIN application_settings
|
99
|
-
ON application_settings.id = 1
|
97
|
+
JOIN application_settings ON (TRUE)
|
100
98
|
WHERE ci_builds.type = 'Ci::Build'
|
101
99
|
AND ci_builds.status = 'running'
|
102
100
|
-- The created_at filter has been introduced for performance reasons only
|
@@ -144,9 +142,9 @@ module GitLab
|
|
144
142
|
ci_builds.trigger_request_id
|
145
143
|
SQL
|
146
144
|
|
147
|
-
|
145
|
+
EE_CHECK_QUERY =
|
148
146
|
<<~SQL.freeze
|
149
|
-
SELECT
|
147
|
+
SELECT COUNT(*) FROM licenses
|
150
148
|
SQL
|
151
149
|
|
152
150
|
REPEATED_COMMANDS_QUERY_EE =
|
@@ -175,8 +173,7 @@ module GitLab
|
|
175
173
|
ON namespaces.id = projects.namespace_id
|
176
174
|
LEFT JOIN namespace_statistics
|
177
175
|
ON namespace_statistics.namespace_id = namespaces.id
|
178
|
-
JOIN application_settings
|
179
|
-
ON application_settings.id = 1
|
176
|
+
JOIN application_settings ON (TRUE)
|
180
177
|
WHERE ci_builds.type = 'Ci::Build'
|
181
178
|
AND ci_builds.status IN ('running', 'pending')
|
182
179
|
-- The created_at filter has been introduced for performance reasons only
|
@@ -265,8 +262,8 @@ module GitLab
|
|
265
262
|
|
266
263
|
DEFAULT_UNARCHIVED_TRACES_OFFSET_MINUTES = 1440
|
267
264
|
|
268
|
-
def initialize(opts)
|
269
|
-
super(opts)
|
265
|
+
def initialize(opts, logger: nil)
|
266
|
+
super(opts, logger: logger)
|
270
267
|
|
271
268
|
@allowed_repeated_commands_count = opts[:allowed_repeated_commands_count]
|
272
269
|
@created_builds_counting_disabled = opts[:created_builds_counting_disabled]
|
@@ -289,7 +286,7 @@ module GitLab
|
|
289
286
|
def builds(status)
|
290
287
|
results = []
|
291
288
|
|
292
|
-
query =
|
289
|
+
query = ee? ? BUILDS_QUERY_EE : BUILDS_QUERY_CE
|
293
290
|
query = query % [status] # rubocop:disable Style/FormatString
|
294
291
|
exec_query_with_custom_random_page_cost(query).each do |row|
|
295
292
|
results << transform_builds_row_to_values(row)
|
@@ -318,7 +315,7 @@ module GitLab
|
|
318
315
|
def per_runner_builds
|
319
316
|
results = []
|
320
317
|
|
321
|
-
query =
|
318
|
+
query = ee? ? PER_RUNNER_QUERY_EE : PER_RUNNER_QUERY_CE
|
322
319
|
exec_query_with_custom_random_page_cost(query).each do |row|
|
323
320
|
results << transform_per_runners_builds_row_to_values(row)
|
324
321
|
end
|
@@ -341,7 +338,7 @@ module GitLab
|
|
341
338
|
def repeated_commands
|
342
339
|
results = []
|
343
340
|
|
344
|
-
query =
|
341
|
+
query = ee? ? REPEATED_COMMANDS_QUERY_EE : REPEATED_COMMANDS_QUERY_CE
|
345
342
|
query = query % [allowed_repeated_commands_count] # rubocop:disable Style/FormatString
|
346
343
|
exec_query_with_custom_random_page_cost(query).each do |row|
|
347
344
|
results << transform_repeated_commands_row_to_values(row)
|
@@ -406,11 +403,11 @@ module GitLab
|
|
406
403
|
end
|
407
404
|
end
|
408
405
|
|
409
|
-
def
|
410
|
-
@
|
406
|
+
def ee?
|
407
|
+
@ee ||=
|
411
408
|
begin
|
412
409
|
with_connection_pool do |conn|
|
413
|
-
conn.exec(
|
410
|
+
conn.exec(EE_CHECK_QUERY)[0]["count"].to_i > 0 # rubocop:disable Style/NumericPredicate
|
414
411
|
end
|
415
412
|
rescue PG::UndefinedColumn
|
416
413
|
false
|
@@ -420,14 +417,14 @@ module GitLab
|
|
420
417
|
|
421
418
|
# The prober which is called when gathering metrics
|
422
419
|
class CiBuildsProber
|
423
|
-
def initialize(opts, metrics: PrometheusMetrics.new)
|
420
|
+
def initialize(opts, metrics: PrometheusMetrics.new, logger: nil)
|
424
421
|
@metrics = metrics
|
425
422
|
|
426
423
|
collector_opts = { connection_string: opts[:connection_string],
|
427
424
|
allowed_repeated_commands_count: opts[:allowed_repeated_commands_count],
|
428
425
|
created_builds_counting_disabled: opts[:created_builds_counting_disabled],
|
429
426
|
unarchived_traces_offset_minutes: opts[:unarchived_traces_offset_minutes] }
|
430
|
-
@collector = CiBuildsCollector.new(collector_opts)
|
427
|
+
@collector = CiBuildsCollector.new(collector_opts, logger: logger)
|
431
428
|
end
|
432
429
|
|
433
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],
|
@@ -175,6 +175,14 @@ module GitLab
|
|
175
175
|
|
176
176
|
def execute(query)
|
177
177
|
with_connection_pool do |conn|
|
178
|
+
conn.exec(query).map_types!(type_map_for_results(conn))
|
179
|
+
end
|
180
|
+
rescue PG::UndefinedTable, PG::UndefinedColumn
|
181
|
+
nil
|
182
|
+
end
|
183
|
+
|
184
|
+
def type_map_for_results(conn)
|
185
|
+
@type_map_for_results ||= begin
|
178
186
|
tm = PG::BasicTypeMapForResults.new(conn)
|
179
187
|
|
180
188
|
# Remove warning message:
|
@@ -187,10 +195,8 @@ module GitLab
|
|
187
195
|
tm.add_coder(old_coder.dup.tap { |c| c.oid = value[:oid] })
|
188
196
|
end
|
189
197
|
|
190
|
-
|
198
|
+
tm
|
191
199
|
end
|
192
|
-
rescue PG::UndefinedTable, PG::UndefinedColumn
|
193
|
-
nil
|
194
200
|
end
|
195
201
|
|
196
202
|
# Not private so I can test it without meta programming tricks
|
@@ -212,7 +218,7 @@ module GitLab
|
|
212
218
|
|
213
219
|
# The prober which is called when gathering metrics
|
214
220
|
class RowCountProber
|
215
|
-
def initialize(opts, metrics: PrometheusMetrics.new)
|
221
|
+
def initialize(opts, metrics: PrometheusMetrics.new, logger: nil) # rubocop:disable Lint/UnusedMethodArgument
|
216
222
|
@metrics = metrics
|
217
223
|
@collector = RowCountCollector.new(
|
218
224
|
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
|
data/lib/gitlab_exporter/git.rb
CHANGED
@@ -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
|
@@ -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)
|
data/spec/database/bloat_spec.rb
CHANGED
@@ -43,7 +43,11 @@ describe GitLab::Exporter::Database::BloatProber do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
describe "#probe_db" do
|
46
|
-
subject { described_class.new(opts, metrics: metrics, collector: collector).probe_db }
|
46
|
+
subject { described_class.new(opts, metrics: metrics, collector: collector, logger: STDOUT).probe_db }
|
47
|
+
|
48
|
+
before do
|
49
|
+
expect(collector).to receive(:logger=).with(STDOUT)
|
50
|
+
end
|
47
51
|
|
48
52
|
it "invokes the collector for each bloat type" do
|
49
53
|
expect(collector).to receive(:run).with(:btree)
|
@@ -9,7 +9,7 @@ describe GitLab::Exporter::Database do
|
|
9
9
|
let(:stale_builds_query) { "SELECT NOT UPDATED RUNNING" }
|
10
10
|
let(:per_runner_query_ee) { "SELECT ALL RUNNING PER RUNNER EE" }
|
11
11
|
let(:per_runner_query_ce) { "SELECT ALL RUNNING PER RUNNER CE" }
|
12
|
-
let(:
|
12
|
+
let(:ee_check_query) { "SELECT COUNT(*) FROM licenses" }
|
13
13
|
let(:repeated_commands_query_ee) { "SELECT EE REPEATED COMNANDS %d" }
|
14
14
|
let(:repeated_commands_query_ce) { "SELECT CE REPEATED COMNANDS %d" }
|
15
15
|
let(:unarchived_traces_query) { "SELECT UNARCHIVED TRACES %s LIST" }
|
@@ -22,11 +22,11 @@ describe GitLab::Exporter::Database do
|
|
22
22
|
let(:unarchived_traces_offset_minutes) { 60 }
|
23
23
|
|
24
24
|
def stub_ee
|
25
|
-
allow(connection).to receive(:exec).with(
|
25
|
+
allow(connection).to receive(:exec).with(ee_check_query).and_return([{ "count" => 1 }])
|
26
26
|
end
|
27
27
|
|
28
28
|
def stub_ce
|
29
|
-
allow(connection).to receive(:exec).with(
|
29
|
+
allow(connection).to receive(:exec).with(ee_check_query).and_return([{ "count" => 0 }])
|
30
30
|
end
|
31
31
|
|
32
32
|
def builds_query_row_ee(shared_runners_enabled, status, namespace_id, has_minutes, count)
|
@@ -86,7 +86,7 @@ describe GitLab::Exporter::Database do
|
|
86
86
|
stub_const("GitLab::Exporter::Database::CiBuildsCollector::STALE_BUILDS_QUERY", stale_builds_query)
|
87
87
|
stub_const("GitLab::Exporter::Database::CiBuildsCollector::PER_RUNNER_QUERY_EE", per_runner_query_ee)
|
88
88
|
stub_const("GitLab::Exporter::Database::CiBuildsCollector::PER_RUNNER_QUERY_CE", per_runner_query_ce)
|
89
|
-
stub_const("GitLab::Exporter::Database::CiBuildsCollector::
|
89
|
+
stub_const("GitLab::Exporter::Database::CiBuildsCollector::EE_CHECK_QUERY", ee_check_query)
|
90
90
|
stub_const("GitLab::Exporter::Database::CiBuildsCollector::REPEATED_COMMANDS_QUERY_EE", repeated_commands_query_ee)
|
91
91
|
stub_const("GitLab::Exporter::Database::CiBuildsCollector::REPEATED_COMMANDS_QUERY_CE", repeated_commands_query_ce)
|
92
92
|
stub_const("GitLab::Exporter::Database::CiBuildsCollector::UNARCHIVED_TRACES_QUERY", unarchived_traces_query)
|
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.
|
4
|
+
version: 7.1.2
|
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:
|