gitlab-exporter 7.0.3 → 7.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +25 -5
- data/Gemfile.lock +15 -13
- data/lib/gitlab_exporter/database/base.rb +6 -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 +11 -5
- 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/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: 9ef9540e75d17cc9904aa53962399870425e6ca52d57ed994dff10d53fad201f
|
4
|
+
data.tar.gz: 7ab18ebbb09faaac5c4924cab93af2059dbe28e4177365771c897a153878daee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05a779426c541c1371d880b9b2d4a321b78243b4bb89ce8c8a4d41e977569f88386505e205719079b0ea85a1bbc3f9d5558bdbb6e1de94de4eb283c05513ad16
|
7
|
+
data.tar.gz: 39fa8909ce99c35bc0e929760cf820593b3ee30526fdb4d10f3230646f63f271b4b3b8e29cc62fbde59106d5f4563335c184f18de21fe8fe5246f7b722ed0b0e
|
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.1)
|
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.
|
17
|
+
connection_pool (2.2.3)
|
18
18
|
diff-lcs (1.3)
|
19
|
-
mustermann (1.
|
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.
|
23
|
+
pg (1.2.3)
|
23
24
|
powerpack (0.1.1)
|
24
25
|
quantile (0.2.1)
|
25
|
-
rack (2.
|
26
|
-
rack-protection (2.0.
|
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.
|
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
|
-
|
53
|
+
ruby2_keywords (0.0.2)
|
54
|
+
sidekiq (5.2.9)
|
53
55
|
connection_pool (~> 2.2, >= 2.2.2)
|
54
|
-
rack (
|
56
|
+
rack (~> 2.0)
|
55
57
|
rack-protection (>= 1.5.0)
|
56
|
-
redis (>= 3.3.5, <
|
57
|
-
sinatra (2.0.
|
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.
|
62
|
+
rack-protection (= 2.0.8.1)
|
61
63
|
tilt (~> 2.0)
|
62
|
-
tilt (2.0.
|
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
|
@@ -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],
|
@@ -110,7 +110,7 @@ module GitLab
|
|
110
110
|
GROUP BY members.user_id
|
111
111
|
) AS u
|
112
112
|
ON users.id = u.user_id",
|
113
|
-
where: "
|
113
|
+
where: "user_type IS NULL",
|
114
114
|
fields: {
|
115
115
|
admin: {},
|
116
116
|
external: {},
|
@@ -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)
|
@@ -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.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
|
@@ -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:
|