gitlab-exporter 17.0.0 → 17.0.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/.gitlab-ci.yml +3 -3
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -1
- data/AGENTS.md +75 -0
- data/CLAUDE.md +1 -0
- data/Gemfile.lock +7 -7
- data/gitlab-exporter.gemspec +2 -2
- data/lib/gitlab_exporter/database/tuple_stats.rb +0 -2
- data/lib/gitlab_exporter/version.rb +1 -1
- data/spec/database/tuple_stats_spec.rb +40 -0
- metadata +8 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 15b0fdb50984859832e6a21dcb76c31dfbfb68f28e5601f2c1389782ea4b5f2f
|
|
4
|
+
data.tar.gz: a02d8bda949c2d5f94981d50123ff845e73d958306d0bcf9e3ca0cfd4c8107e5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ab40fc6975a31c6175cb3139dd1e576a06f7f1a6b598efc387f76228e68413a47b7902d7aca1682128ee77dd76ee4f2e178fec7bed8dc027676ec2e614289490
|
|
7
|
+
data.tar.gz: e749cdfd3a8db77f8a594ad7007db5dc919003defa0afb7c3691a461b78d0bcdf459e8bce6d5106809f0cdc567323a968fe1d8de88c990a2c5074339b6c38343
|
data/.gitlab-ci.yml
CHANGED
|
@@ -32,7 +32,7 @@ default:
|
|
|
32
32
|
# to avoid https://github.com/rubygems/rubygems/issues/5380 use an
|
|
33
33
|
# older Bundler version.
|
|
34
34
|
case ${RUBY_VERSION} in
|
|
35
|
-
"3.
|
|
35
|
+
"3.1")
|
|
36
36
|
export BUNDLER_VERSION="2.4.20"
|
|
37
37
|
;;
|
|
38
38
|
esac
|
|
@@ -53,7 +53,7 @@ rspec:
|
|
|
53
53
|
before_script: *before_scripts
|
|
54
54
|
parallel:
|
|
55
55
|
matrix:
|
|
56
|
-
- RUBY_VERSION: ["3.
|
|
56
|
+
- RUBY_VERSION: ["3.1", "3.2", "3.3", "3.4", "4.0"]
|
|
57
57
|
|
|
58
58
|
rspec_integration:
|
|
59
59
|
script:
|
|
@@ -88,7 +88,7 @@ rspec_integration:
|
|
|
88
88
|
REDIS_SENTINEL_PASSWORD: "my-sentinel-password"
|
|
89
89
|
parallel:
|
|
90
90
|
matrix:
|
|
91
|
-
- RUBY_VERSION: ["3.
|
|
91
|
+
- RUBY_VERSION: ["3.1", "3.2", "3.3", "3.4", "4.0"]
|
|
92
92
|
|
|
93
93
|
rubocop:
|
|
94
94
|
script:
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.1.7
|
data/AGENTS.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# gitlab-exporter — AI agent guidelines
|
|
2
|
+
|
|
3
|
+
gitlab-exporter is a Prometheus web exporter (a Ruby gem) that collects GitLab
|
|
4
|
+
production metrics via custom probes and exposes them over HTTP for a Prometheus
|
|
5
|
+
scraper. See `README.md` for the probe catalog.
|
|
6
|
+
|
|
7
|
+
## Project layout
|
|
8
|
+
|
|
9
|
+
- `lib/gitlab_exporter/` — probes and the exporter runtime
|
|
10
|
+
- `lib/gitlab_exporter/version.rb` — the gem version; bumping this on `master`
|
|
11
|
+
triggers a release (see below)
|
|
12
|
+
- `bin/gitlab-exporter` — executable entry point
|
|
13
|
+
- `spec/` — RSpec tests (`-t integration` marks integration specs that need Redis/PG)
|
|
14
|
+
|
|
15
|
+
## Development commands
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
bundle install
|
|
19
|
+
bundle exec rspec spec # unit tests
|
|
20
|
+
bundle exec rspec spec -t integration # integration tests (needs Redis/Postgres)
|
|
21
|
+
bundle exec rubocop # lint
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Commit messages
|
|
25
|
+
|
|
26
|
+
Follow the [GitLab commit message guidelines](https://docs.gitlab.com/development/contributing/merge_request_workflow/#commit-messages-guidelines).
|
|
27
|
+
|
|
28
|
+
- Subject: imperative mood, capitalized, no trailing period, ≤ 72 chars
|
|
29
|
+
("Add Zoekt probe", not "Added Zoekt probe").
|
|
30
|
+
- Body: explain *why*, wrap at 72 chars. Reference issues/MRs with full URLs,
|
|
31
|
+
not short references (`#123`).
|
|
32
|
+
|
|
33
|
+
## Changelog trailer (required for user-facing changes)
|
|
34
|
+
|
|
35
|
+
Releases are cut by the `gem-release` CI component, which builds the release
|
|
36
|
+
notes from GitLab's changelog generator. That generator **only includes commits
|
|
37
|
+
that carry a `Changelog:` git trailer** — commits without one are dropped, which
|
|
38
|
+
is why a release can end up saying "No changes." and produce an empty changelog
|
|
39
|
+
in downstream projects (e.g. omnibus-gitlab's Renovate MRs).
|
|
40
|
+
|
|
41
|
+
Add the trailer as a **separate block at the end of the commit message**,
|
|
42
|
+
preceded by a blank line (the blank line is required for git to parse it as a
|
|
43
|
+
trailer; without it the changelog generator silently drops the commit):
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
Changelog: <type>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Valid types: `added`, `fixed`, `changed`, `deprecated`, `removed`, `security`,
|
|
50
|
+
`performance`, `other`.
|
|
51
|
+
|
|
52
|
+
**Include a trailer for:** new or changed probes/metrics, behavior changes,
|
|
53
|
+
bug fixes, dependency bumps that affect users, security fixes.
|
|
54
|
+
|
|
55
|
+
**Skip the trailer for:** test-only changes, documentation-only changes, CI/
|
|
56
|
+
tooling-only changes, and pure internal refactors with no user-visible effect.
|
|
57
|
+
|
|
58
|
+
Example:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
Add remote mirror staleness metric
|
|
62
|
+
|
|
63
|
+
Exposes project_remote_mirror_last_successful_update_time_seconds so
|
|
64
|
+
operators can alert on mirrors that have stopped syncing.
|
|
65
|
+
|
|
66
|
+
Changelog: added
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Releasing
|
|
70
|
+
|
|
71
|
+
A release happens when `lib/gitlab_exporter/version.rb` changes on `master`.
|
|
72
|
+
The CI pipeline then generates the changelog from the `Changelog:` trailers
|
|
73
|
+
since the previous tag, creates the GitLab Release, and publishes the gem to
|
|
74
|
+
RubyGems. Keeping trailers accurate on every merged commit is what makes those
|
|
75
|
+
release notes meaningful.
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@AGENTS.md
|
data/Gemfile.lock
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
gitlab-exporter (17.0.
|
|
5
|
-
base64 (= 0.
|
|
4
|
+
gitlab-exporter (17.0.1)
|
|
5
|
+
base64 (= 0.3.0)
|
|
6
6
|
connection_pool (= 2.5.5)
|
|
7
7
|
deep_merge (~> 1.2.2)
|
|
8
8
|
faraday (= 2.14.3)
|
|
@@ -17,7 +17,7 @@ GEM
|
|
|
17
17
|
remote: https://rubygems.org/
|
|
18
18
|
specs:
|
|
19
19
|
ast (2.4.3)
|
|
20
|
-
base64 (0.
|
|
20
|
+
base64 (0.3.0)
|
|
21
21
|
connection_pool (2.5.5)
|
|
22
22
|
deep_merge (1.2.2)
|
|
23
23
|
diff-lcs (1.5.0)
|
|
@@ -57,11 +57,11 @@ GEM
|
|
|
57
57
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
58
58
|
rspec-support (~> 3.12.0)
|
|
59
59
|
rspec-support (3.12.0)
|
|
60
|
-
rubocop (1.
|
|
60
|
+
rubocop (1.89.0)
|
|
61
61
|
json (~> 2.3)
|
|
62
62
|
language_server-protocol (~> 3.17.0.2)
|
|
63
63
|
lint_roller (~> 1.1.0)
|
|
64
|
-
parallel (
|
|
64
|
+
parallel (>= 1.10)
|
|
65
65
|
parser (>= 3.3.0.2)
|
|
66
66
|
rainbow (>= 2.2.2, < 4.0)
|
|
67
67
|
regexp_parser (>= 2.9.3, < 3.0)
|
|
@@ -78,7 +78,7 @@ GEM
|
|
|
78
78
|
redis (>= 4.5.0, < 5)
|
|
79
79
|
unicode-display_width (3.1.4)
|
|
80
80
|
unicode-emoji (~> 4.0, >= 4.0.4)
|
|
81
|
-
unicode-emoji (4.0
|
|
81
|
+
unicode-emoji (4.2.0)
|
|
82
82
|
webrick (1.9.1)
|
|
83
83
|
|
|
84
84
|
PLATFORMS
|
|
@@ -91,4 +91,4 @@ DEPENDENCIES
|
|
|
91
91
|
rubocop (~> 1.0)
|
|
92
92
|
|
|
93
93
|
BUNDLED WITH
|
|
94
|
-
|
|
94
|
+
4.0.10
|
data/gitlab-exporter.gemspec
CHANGED
|
@@ -20,12 +20,12 @@ Gem::Specification.new do |s|
|
|
|
20
20
|
s.homepage = "https://gitlab.com/gitlab-org/ruby/gems/gitlab-exporter"
|
|
21
21
|
s.license = "MIT"
|
|
22
22
|
|
|
23
|
-
s.required_ruby_version = Gem::Requirement.new(">= 3.
|
|
23
|
+
s.required_ruby_version = Gem::Requirement.new(">= 3.1")
|
|
24
24
|
|
|
25
25
|
# base64 is required by sidekiq but not declared by it, and is no longer a
|
|
26
26
|
# default gem as of Ruby 3.4. It used to be pulled in transitively via
|
|
27
27
|
# sinatra -> rack-protection; declare it directly now that those are gone.
|
|
28
|
-
s.add_runtime_dependency "base64", "0.
|
|
28
|
+
s.add_runtime_dependency "base64", "0.3.0"
|
|
29
29
|
s.add_runtime_dependency "connection_pool", "2.5.5"
|
|
30
30
|
s.add_runtime_dependency "deep_merge", "~> 1.2.2"
|
|
31
31
|
s.add_runtime_dependency "faraday", "2.14.3"
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
require "gitlab_exporter/database/tuple_stats"
|
|
3
|
+
|
|
4
|
+
describe GitLab::Exporter::Database::TuplesProber do
|
|
5
|
+
let(:opts) { { connection_string: "" } }
|
|
6
|
+
let(:metrics) { double("PrometheusMetrics", add: nil) }
|
|
7
|
+
let(:collector) { double("TupleStatsCollector", run: data) }
|
|
8
|
+
|
|
9
|
+
before do
|
|
10
|
+
allow(GitLab::Exporter::Database::TupleStatsCollector).to receive(:new).and_return(collector)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe "#probe_db" do
|
|
14
|
+
subject { described_class.new(metrics: metrics, **opts).probe_db }
|
|
15
|
+
|
|
16
|
+
context "when the connection casts columns to native Integer (PG::BasicTypeMapForResults)" do
|
|
17
|
+
let(:data) { { "projects" => { "seq_tup_read" => 42, "n_dead_tup" => 0 } } }
|
|
18
|
+
|
|
19
|
+
it "still records a metric for every column" do
|
|
20
|
+
expect(metrics).to receive(:add)
|
|
21
|
+
.with("gitlab_database_stat_table_seq_tup_read", 42.0, table_name: "projects")
|
|
22
|
+
expect(metrics).to receive(:add)
|
|
23
|
+
.with("gitlab_database_stat_table_n_dead_tup", 0.0, table_name: "projects")
|
|
24
|
+
|
|
25
|
+
subject
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
context "when the connection returns unmapped string values" do
|
|
30
|
+
let(:data) { { "projects" => { "seq_tup_read" => "42" } } }
|
|
31
|
+
|
|
32
|
+
it "records a metric" do
|
|
33
|
+
expect(metrics).to receive(:add)
|
|
34
|
+
.with("gitlab_database_stat_table_seq_tup_read", 42.0, table_name: "projects")
|
|
35
|
+
|
|
36
|
+
subject
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
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: 17.0.
|
|
4
|
+
version: 17.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pablo Carranza
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - '='
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.
|
|
19
|
+
version: 0.3.0
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - '='
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.
|
|
26
|
+
version: 0.3.0
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: connection_pool
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -191,6 +191,8 @@ files:
|
|
|
191
191
|
- ".rubocop.yml"
|
|
192
192
|
- ".rubocop_todo.yml"
|
|
193
193
|
- ".ruby-version"
|
|
194
|
+
- AGENTS.md
|
|
195
|
+
- CLAUDE.md
|
|
194
196
|
- CONTRIBUTING.md
|
|
195
197
|
- Gemfile
|
|
196
198
|
- Gemfile.lock
|
|
@@ -230,6 +232,7 @@ files:
|
|
|
230
232
|
- spec/database/ci_builds_spec.rb
|
|
231
233
|
- spec/database/pg_sequences_spec.rb
|
|
232
234
|
- spec/database/row_count_spec.rb
|
|
235
|
+
- spec/database/tuple_stats_spec.rb
|
|
233
236
|
- spec/database/zoekt_spec.rb
|
|
234
237
|
- spec/elasticsearch_spec.rb
|
|
235
238
|
- spec/fixtures/config.yml
|
|
@@ -256,7 +259,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
256
259
|
requirements:
|
|
257
260
|
- - ">="
|
|
258
261
|
- !ruby/object:Gem::Version
|
|
259
|
-
version: '3.
|
|
262
|
+
version: '3.1'
|
|
260
263
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
261
264
|
requirements:
|
|
262
265
|
- - ">="
|
|
@@ -273,6 +276,7 @@ test_files:
|
|
|
273
276
|
- spec/database/ci_builds_spec.rb
|
|
274
277
|
- spec/database/pg_sequences_spec.rb
|
|
275
278
|
- spec/database/row_count_spec.rb
|
|
279
|
+
- spec/database/tuple_stats_spec.rb
|
|
276
280
|
- spec/database/zoekt_spec.rb
|
|
277
281
|
- spec/elasticsearch_spec.rb
|
|
278
282
|
- spec/fixtures/config.yml
|