gitlab-exporter 16.4.0 → 16.4.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 +4 -4
- data/Gemfile.lock +8 -8
- data/gitlab-exporter.gemspec +1 -1
- data/lib/gitlab_exporter/database/zoekt.rb +24 -14
- data/lib/gitlab_exporter/version.rb +1 -1
- data/spec/database/zoekt_spec.rb +14 -9
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ddf051049df2fc97f6075da3453f40c99dbd5924613e52f7613f68f4061369d1
|
|
4
|
+
data.tar.gz: 2e5d19430d6de12d9ef679a74719e0047671955edf2a7a5cfbfa16128920493e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 62fe67971ee82117f04fa6189867450469f67ba2818719ec4f0bec39a601cce5a47bfcecbaab02ce22c4f07fd16094a8e12d6fee258611555fd6f2605ae3f209
|
|
7
|
+
data.tar.gz: 706d36baae273e77e2211ade5dec5848316f1d5a473c33aa89e7e11ce20814bc5ffbd83735f3f20c1090c072b4fed5f4f056ab2472c2bd1ef2096b08f018151c
|
data/Gemfile.lock
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
gitlab-exporter (16.4.
|
|
4
|
+
gitlab-exporter (16.4.1)
|
|
5
5
|
connection_pool (= 2.5.5)
|
|
6
6
|
deep_merge (~> 1.2.2)
|
|
7
7
|
faraday (= 2.14.0)
|
|
8
8
|
pg (= 1.6.3)
|
|
9
|
-
puma (= 7.
|
|
9
|
+
puma (= 7.2.0)
|
|
10
10
|
quantile (= 0.2.1)
|
|
11
11
|
redis (= 4.8.1)
|
|
12
12
|
redis-namespace (= 1.11.0)
|
|
@@ -39,8 +39,8 @@ GEM
|
|
|
39
39
|
ast (~> 2.4.1)
|
|
40
40
|
racc
|
|
41
41
|
pg (1.6.3)
|
|
42
|
-
prism (1.
|
|
43
|
-
puma (7.
|
|
42
|
+
prism (1.9.0)
|
|
43
|
+
puma (7.2.0)
|
|
44
44
|
nio4r (~> 2.0)
|
|
45
45
|
quantile (0.2.1)
|
|
46
46
|
racc (1.8.1)
|
|
@@ -66,7 +66,7 @@ GEM
|
|
|
66
66
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
67
67
|
rspec-support (~> 3.12.0)
|
|
68
68
|
rspec-support (3.12.0)
|
|
69
|
-
rubocop (1.
|
|
69
|
+
rubocop (1.84.1)
|
|
70
70
|
json (~> 2.3)
|
|
71
71
|
language_server-protocol (~> 3.17.0.2)
|
|
72
72
|
lint_roller (~> 1.1.0)
|
|
@@ -74,12 +74,12 @@ GEM
|
|
|
74
74
|
parser (>= 3.3.0.2)
|
|
75
75
|
rainbow (>= 2.2.2, < 4.0)
|
|
76
76
|
regexp_parser (>= 2.9.3, < 3.0)
|
|
77
|
-
rubocop-ast (>= 1.
|
|
77
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
78
78
|
ruby-progressbar (~> 1.7)
|
|
79
79
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
80
|
-
rubocop-ast (1.
|
|
80
|
+
rubocop-ast (1.49.0)
|
|
81
81
|
parser (>= 3.3.7.2)
|
|
82
|
-
prism (~> 1.
|
|
82
|
+
prism (~> 1.7)
|
|
83
83
|
ruby-progressbar (1.13.0)
|
|
84
84
|
ruby2_keywords (0.0.5)
|
|
85
85
|
sidekiq (6.5.12)
|
data/gitlab-exporter.gemspec
CHANGED
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
|
26
26
|
s.add_runtime_dependency "deep_merge", "~> 1.2.2"
|
|
27
27
|
s.add_runtime_dependency "faraday", "2.14.0"
|
|
28
28
|
s.add_runtime_dependency "pg", "1.6.3"
|
|
29
|
-
s.add_runtime_dependency "puma", "7.
|
|
29
|
+
s.add_runtime_dependency "puma", "7.2.0"
|
|
30
30
|
s.add_runtime_dependency "quantile", "0.2.1"
|
|
31
31
|
s.add_runtime_dependency "redis", "4.8.1"
|
|
32
32
|
s.add_runtime_dependency "redis-namespace", "1.11.0"
|
|
@@ -28,12 +28,11 @@ module GitLab
|
|
|
28
28
|
SQL
|
|
29
29
|
|
|
30
30
|
ZOEKT_NODES_QUERY = <<~SQL.freeze
|
|
31
|
-
SELECT schema_version, id FROM zoekt_nodes
|
|
31
|
+
SELECT schema_version, id, metadata ->> 'name' AS node_name FROM zoekt_nodes
|
|
32
32
|
SQL
|
|
33
33
|
|
|
34
34
|
ZOEKT_NODES_STATUS_QUERY = <<~SQL.freeze
|
|
35
|
-
SELECT
|
|
36
|
-
id,
|
|
35
|
+
SELECT id, metadata ->> 'name' AS node_name,
|
|
37
36
|
CASE
|
|
38
37
|
WHEN last_seen_at < NOW() - INTERVAL '2 minute' THEN 0
|
|
39
38
|
ELSE 1
|
|
@@ -88,22 +87,25 @@ module GitLab
|
|
|
88
87
|
|
|
89
88
|
hash = {}
|
|
90
89
|
zoekt_nodes.each do |row|
|
|
91
|
-
hash[row["id"]] = row["schema_version"]
|
|
90
|
+
hash[row["id"]] = [row["schema_version"], row["node_name"]]
|
|
92
91
|
end
|
|
93
92
|
hash
|
|
94
93
|
end
|
|
95
94
|
|
|
96
95
|
def zoekt_repository_schema_version_result(hash)
|
|
97
96
|
result = Set.new
|
|
98
|
-
hash.each do |id,
|
|
99
|
-
query_result = execute(ZOEKT_REPOSITORY_SCHEMA_VERSION_QUERY, [id,
|
|
97
|
+
hash.each do |id, schema_version_name_arr|
|
|
98
|
+
query_result = execute(ZOEKT_REPOSITORY_SCHEMA_VERSION_QUERY, [id, schema_version_name_arr[0]])
|
|
100
99
|
if query_result.nil?
|
|
101
100
|
result = nil
|
|
102
101
|
break
|
|
103
102
|
end
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
result.add(
|
|
104
|
+
{
|
|
105
|
+
target_schema_version: schema_version_name_arr[0], zoekt_node_id: id,
|
|
106
|
+
zoekt_node_name: schema_version_name_arr[1], unfinished_repository_count: query_result[0]["count"].to_i
|
|
107
|
+
}
|
|
108
|
+
)
|
|
107
109
|
end
|
|
108
110
|
result
|
|
109
111
|
end
|
|
@@ -174,8 +176,10 @@ module GitLab
|
|
|
174
176
|
@metrics.add(
|
|
175
177
|
"search_zoekt_task_processing_queue_size",
|
|
176
178
|
row["task_count"].to_i,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
+
**{
|
|
180
|
+
node_name: row["node_name"],
|
|
181
|
+
node_id: row["node_id"]
|
|
182
|
+
}.compact
|
|
179
183
|
)
|
|
180
184
|
end
|
|
181
185
|
|
|
@@ -183,8 +187,11 @@ module GitLab
|
|
|
183
187
|
@metrics.add(
|
|
184
188
|
"search_zoekt_repositories_schema_version_count",
|
|
185
189
|
row[:unfinished_repository_count].to_i,
|
|
186
|
-
|
|
187
|
-
|
|
190
|
+
**{
|
|
191
|
+
target_schema_version: row[:target_schema_version],
|
|
192
|
+
zoekt_node_id: row[:zoekt_node_id],
|
|
193
|
+
zoekt_node_name: row[:zoekt_node_name]
|
|
194
|
+
}.compact
|
|
188
195
|
)
|
|
189
196
|
end
|
|
190
197
|
|
|
@@ -192,7 +199,10 @@ module GitLab
|
|
|
192
199
|
@metrics.add(
|
|
193
200
|
"search_zoekt_nodes_status",
|
|
194
201
|
row["status"].to_i,
|
|
195
|
-
|
|
202
|
+
**{
|
|
203
|
+
zoekt_node_id: row["id"],
|
|
204
|
+
zoekt_node_name: row["node_name"]
|
|
205
|
+
}.compact
|
|
196
206
|
)
|
|
197
207
|
end
|
|
198
208
|
|
data/spec/database/zoekt_spec.rb
CHANGED
|
@@ -6,11 +6,11 @@ describe GitLab::Exporter::Database::ZoektCollector do
|
|
|
6
6
|
let(:connection) { double("connection") }
|
|
7
7
|
let(:zoekt_tasks_processing_query) { described_class::ZOEKT_TASKS_PROCESSING_QUERY }
|
|
8
8
|
let(:zoekt_nodes_query) { described_class::ZOEKT_NODES_QUERY }
|
|
9
|
-
let(:zoekt_nodes_query_results) { [{ "id" => "1", "schema_version" => "2302" }] }
|
|
9
|
+
let(:zoekt_nodes_query_results) { [{ "id" => "1", "schema_version" => "2302", "node_name" => "foo" }] }
|
|
10
10
|
let(:zoekt_enabled_query) { described_class::ZOEKT_ENABLED_QUERY }
|
|
11
11
|
let(:zoekt_repository_schema_version_query) { described_class::ZOEKT_REPOSITORY_SCHEMA_VERSION_QUERY }
|
|
12
12
|
let(:zoekt_nodes_status_query) { described_class::ZOEKT_NODES_STATUS_QUERY }
|
|
13
|
-
let(:zoekt_nodes_status_query_results) { [{ "id" => "1", "status" => "1" }] }
|
|
13
|
+
let(:zoekt_nodes_status_query_results) { [{ "id" => "1", "name" => "foo", "status" => "1" }] }
|
|
14
14
|
|
|
15
15
|
let(:zoekt_repository_schema_version_query_results) { [{ "count" => "1" }] }
|
|
16
16
|
|
|
@@ -41,7 +41,9 @@ describe GitLab::Exporter::Database::ZoektCollector do
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
let(:zoekt_repositories_schema_version_query_results) do
|
|
44
|
-
Set.new(
|
|
44
|
+
Set.new(
|
|
45
|
+
[{ target_schema_version: "2302", zoekt_node_id: "1", zoekt_node_name: "foo", unfinished_repository_count: 1 }]
|
|
46
|
+
)
|
|
45
47
|
end
|
|
46
48
|
|
|
47
49
|
let(:result) do
|
|
@@ -136,7 +138,7 @@ describe GitLab::Exporter::Database::ZoektProber do
|
|
|
136
138
|
let(:data) do
|
|
137
139
|
{
|
|
138
140
|
repositories_schema_version_query_result: Set.new(
|
|
139
|
-
[{ target_schema_version: "2302", zoekt_node_id: "1", unfinished_repository_count: 1 }]
|
|
141
|
+
[{ target_schema_version: "2302", zoekt_node_id: "1", unfinished_repository_count: 1, zoekt_node_name: "foo" }]
|
|
140
142
|
),
|
|
141
143
|
task_processing_query_result: [
|
|
142
144
|
{ "node_id" => "1", "node_name" => "zoekt-1", "task_count" => "5" },
|
|
@@ -165,10 +167,12 @@ describe GitLab::Exporter::Database::ZoektProber do
|
|
|
165
167
|
|
|
166
168
|
data[:task_processing_query_result].each do |node_data|
|
|
167
169
|
expect(metrics).to receive(:add)
|
|
168
|
-
.with(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
.with(
|
|
171
|
+
"search_zoekt_task_processing_queue_size",
|
|
172
|
+
node_data["task_count"].to_i,
|
|
173
|
+
node_name: node_data["node_name"],
|
|
174
|
+
node_id: node_data["node_id"]
|
|
175
|
+
)
|
|
172
176
|
end
|
|
173
177
|
|
|
174
178
|
data[:repositories_schema_version_query_result].each do |node_data|
|
|
@@ -177,7 +181,8 @@ describe GitLab::Exporter::Database::ZoektProber do
|
|
|
177
181
|
"search_zoekt_repositories_schema_version_count",
|
|
178
182
|
node_data[:unfinished_repository_count].to_i,
|
|
179
183
|
target_schema_version: node_data[:target_schema_version],
|
|
180
|
-
zoekt_node_id: node_data[:zoekt_node_id]
|
|
184
|
+
zoekt_node_id: node_data[:zoekt_node_id],
|
|
185
|
+
zoekt_node_name: node_data[:zoekt_node_name]
|
|
181
186
|
)
|
|
182
187
|
end
|
|
183
188
|
|
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.4.
|
|
4
|
+
version: 16.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pablo Carranza
|
|
@@ -72,14 +72,14 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - '='
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 7.
|
|
75
|
+
version: 7.2.0
|
|
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: 7.
|
|
82
|
+
version: 7.2.0
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: quantile
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|