yabeda-gc 0.2.1 → 0.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c15161b50122262318a3fde5329b9c7ffa4ec75c4d358ae2248bd60007e7139
4
- data.tar.gz: 9d343e04a8c27b38ada68a6b4a3b606b0defe8f4bfc603702b4959057083ea00
3
+ metadata.gz: a7f791f3e51087fa9a6ef485b8b0ed77ac5f36a44477b293c362565cf2934f90
4
+ data.tar.gz: 2255d5e72d224021bd4eca3a29555ebdad593bc8bc49f9f8772f356b4581e6bd
5
5
  SHA512:
6
- metadata.gz: a97ed85bbf2991ba54bf7fe6e350ca06a90f8b3bd07f0f53a85fa3d61219203f6ec12920b8d30fcea96c1993dafcdbd8a004a82f43443f13e080a3204a70f6df
7
- data.tar.gz: 86aec667687e9b97b7b95e08486135f37593be016916ea8e0baf4bc648e392ddea7fc9de63a3bc4142c4a43d76fe63844ff0f0591d18f6be85c398df2317f0b9
6
+ metadata.gz: 483b0255050ec289004d223ceeae5a1d4d11d7ad2941f58db16a796be92ab43d99f6b814fb9bf8264add0011f16fc3d5d8b0e44481c424699c556abe5a2ec4b5
7
+ data.tar.gz: 14c7b474c2462fe2402a62bd35b34b9d283ca731d313f223e2fdab5d48e0d1c39890d973c613859e12c687ec42b4ebade9d467dfa269384bf09b09bb292f03fa
@@ -9,15 +9,17 @@ on:
9
9
  - 'v*'
10
10
 
11
11
  jobs:
12
- build:
12
+ rubocop:
13
+ # Skip running tests for local pull requests (use push event instead), run only for foreign ones
14
+ if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
13
15
  name: Rubocop
14
16
  runs-on: ubuntu-latest
15
17
  steps:
16
- - uses: actions/checkout@v3
18
+ - uses: actions/checkout@v4
17
19
  - name: Set up Ruby
18
20
  uses: ruby/setup-ruby@v1
19
21
  with:
20
- ruby-version: 3.1
22
+ ruby-version: "3.3"
21
23
  bundler-cache: true
22
24
  - name: Run Rubocop
23
25
  run: bundle exec rake rubocop
@@ -0,0 +1,82 @@
1
+ name: Release gem to RubyGems
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - v*
7
+
8
+ jobs:
9
+ release:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: write
13
+ id-token: write
14
+ packages: write
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ with:
19
+ fetch-depth: 0 # Fetch current tag as annotated. See https://github.com/actions/checkout/issues/290
20
+ - uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: 3.2
23
+ - name: "Extract data from tag: version, message, body"
24
+ id: tag
25
+ run: |
26
+ git fetch --tags --force # Really fetch annotated tag. See https://github.com/actions/checkout/issues/290#issuecomment-680260080
27
+ echo ::set-output name=version::${GITHUB_REF#refs/tags/v}
28
+ echo ::set-output name=subject::$(git for-each-ref $GITHUB_REF --format='%(contents:subject)')
29
+ BODY="$(git for-each-ref $GITHUB_REF --format='%(contents:body)')"
30
+ # Extract changelog entries between this and previous version headers
31
+ escaped_version=$(echo ${GITHUB_REF#refs/tags/v} | sed -e 's/[]\/$*.^[]/\\&/g')
32
+ changelog=$(awk "BEGIN{inrelease=0} /## \[${escaped_version}\]/{inrelease=1;next} /## \[[0-9]+\.[0-9]+\.[0-9]+.*?\]/{inrelease=0;exit} {if (inrelease) print}" CHANGELOG.md)
33
+ # Multiline body for release. See https://github.community/t/set-output-truncates-multiline-strings/16852/5
34
+ BODY="${BODY}"$'\n'"${changelog}"
35
+ BODY="${BODY//'%'/'%25'}"
36
+ BODY="${BODY//$'\n'/'%0A'}"
37
+ BODY="${BODY//$'\r'/'%0D'}"
38
+ echo "::set-output name=body::$BODY"
39
+ # Add pre-release option if tag name has any suffix after vMAJOR.MINOR.PATCH
40
+ if [[ ${GITHUB_REF#refs/tags/} =~ ^v[0-9]+\.[0-9]+\.[0-9]+.+ ]]; then
41
+ echo ::set-output name=prerelease::true
42
+ fi
43
+ - name: Build gem
44
+ run: gem build
45
+ - name: Calculate checksums
46
+ run: sha256sum yabeda-gc-${{ steps.tag.outputs.version }}.gem > SHA256SUM
47
+ - name: Check version
48
+ run: ls -l yabeda-gc-${{ steps.tag.outputs.version }}.gem
49
+ - name: Create Release
50
+ id: create_release
51
+ uses: actions/create-release@v1
52
+ env:
53
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54
+ with:
55
+ tag_name: ${{ github.ref }}
56
+ release_name: ${{ steps.tag.outputs.subject }}
57
+ body: ${{ steps.tag.outputs.body }}
58
+ draft: false
59
+ prerelease: ${{ steps.tag.outputs.prerelease }}
60
+ - name: Upload built gem as release asset
61
+ uses: actions/upload-release-asset@v1
62
+ env:
63
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64
+ with:
65
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
66
+ asset_path: yabeda-gc-${{ steps.tag.outputs.version }}.gem
67
+ asset_name: yabeda-gc-${{ steps.tag.outputs.version }}.gem
68
+ asset_content_type: application/x-tar
69
+ - name: Upload checksums as release asset
70
+ uses: actions/upload-release-asset@v1
71
+ env:
72
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73
+ with:
74
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
75
+ asset_path: SHA256SUM
76
+ asset_name: SHA256SUM
77
+ asset_content_type: text/plain
78
+ - name: Configure RubyGems Credentials
79
+ uses: rubygems/configure-rubygems-credentials@main
80
+ - name: Publish to RubyGems
81
+ run: |
82
+ gem push yabeda-gc-${{ steps.tag.outputs.version }}.gem
@@ -9,15 +9,22 @@ on:
9
9
  - 'v*'
10
10
 
11
11
  jobs:
12
- build:
12
+ test:
13
+ # Skip running tests for local pull requests (use push event instead), run only for foreign ones
14
+ if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
13
15
  name: "Ruby ${{ matrix.ruby }}"
14
16
  runs-on: ubuntu-latest
15
17
  strategy:
16
18
  fail-fast: false
17
19
  matrix:
18
- ruby: ['2.7', '3.0', '3.1', head]
20
+ ruby:
21
+ - '3.0'
22
+ - '3.1'
23
+ - '3.2'
24
+ - '3.3'
25
+ - 'head'
19
26
  steps:
20
- - uses: actions/checkout@v3
27
+ - uses: actions/checkout@v4
21
28
  - name: Set up Ruby
22
29
  uses: ruby/setup-ruby@v1
23
30
  with:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.0] - 2024-01-04
4
+
5
+ ### Added
6
+
7
+ - Ruby 3.3 metrics: `marking_time` and `sweeping_time`. [@aroop] in [#5](https://github.com/ianks/yabeda-gc/pull/5)
8
+
9
+ ## [0.2.1] - 2022-06-22
10
+
11
+ ### Fixed
12
+
13
+ - Declare `time` metric for GC only on Ruby 3.1. [@Envek]
14
+
15
+ ## [0.2.0] - 2022-06-21
16
+
17
+ ### Added
18
+
19
+ - Ruby 3.1 metrics: `time`, `total_moved_objects`, `read_barrier_faults`. [@tarapon] in [#3](https://github.com/ianks/yabeda-gc/pull/3)
20
+
21
+ ## [0.1.1] - 2021-02-24
22
+
23
+ ### Added
24
+
25
+ - `compact_count` metric. [@ianks]
26
+
3
27
  ## [0.1.0] - 2021-02-24
4
28
 
5
29
  - Initial release
30
+
31
+ [@ianks]: https://github.com/ianks] "Ian Ker-Seymer"
32
+ [@tarapon]: https://github.com/tarapon "Ivan Tarapon"
33
+ [@Envek]: https://github.com/Envek "Andrey Novikov"
34
+ [@aroop]: https://github.com/aroop "Ajay Guthikonda"
data/Gemfile.lock CHANGED
@@ -1,58 +1,64 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yabeda-gc (0.2.1)
4
+ yabeda-gc (0.3.0)
5
5
  yabeda (~> 0.6)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- anyway_config (2.3.0)
10
+ anyway_config (2.5.4)
11
11
  ruby-next-core (>= 0.14.0)
12
12
  ast (2.4.2)
13
13
  coderay (1.1.3)
14
- concurrent-ruby (1.1.10)
14
+ concurrent-ruby (1.2.2)
15
15
  diff-lcs (1.5.0)
16
16
  dry-initializer (3.1.1)
17
+ json (2.7.1)
18
+ language_server-protocol (3.17.0.3)
17
19
  method_source (1.0.0)
18
- parallel (1.22.1)
19
- parser (3.1.2.0)
20
+ parallel (1.24.0)
21
+ parser (3.2.2.4)
20
22
  ast (~> 2.4.1)
21
- pry (0.14.0)
23
+ racc
24
+ pry (0.14.2)
22
25
  coderay (~> 1.1)
23
26
  method_source (~> 1.0)
27
+ racc (1.7.3)
24
28
  rainbow (3.1.1)
25
- rake (13.0.3)
26
- regexp_parser (2.5.0)
27
- rexml (3.2.5)
28
- rspec (3.11.0)
29
- rspec-core (~> 3.11.0)
30
- rspec-expectations (~> 3.11.0)
31
- rspec-mocks (~> 3.11.0)
32
- rspec-core (3.11.0)
33
- rspec-support (~> 3.11.0)
34
- rspec-expectations (3.11.0)
29
+ rake (13.1.0)
30
+ regexp_parser (2.8.3)
31
+ rexml (3.2.6)
32
+ rspec (3.12.0)
33
+ rspec-core (~> 3.12.0)
34
+ rspec-expectations (~> 3.12.0)
35
+ rspec-mocks (~> 3.12.0)
36
+ rspec-core (3.12.2)
37
+ rspec-support (~> 3.12.0)
38
+ rspec-expectations (3.12.3)
35
39
  diff-lcs (>= 1.2.0, < 2.0)
36
- rspec-support (~> 3.11.0)
37
- rspec-mocks (3.11.1)
40
+ rspec-support (~> 3.12.0)
41
+ rspec-mocks (3.12.6)
38
42
  diff-lcs (>= 1.2.0, < 2.0)
39
- rspec-support (~> 3.11.0)
40
- rspec-support (3.11.0)
41
- rubocop (1.30.1)
43
+ rspec-support (~> 3.12.0)
44
+ rspec-support (3.12.1)
45
+ rubocop (1.59.0)
46
+ json (~> 2.3)
47
+ language_server-protocol (>= 3.17.0)
42
48
  parallel (~> 1.10)
43
- parser (>= 3.1.0.0)
49
+ parser (>= 3.2.2.4)
44
50
  rainbow (>= 2.2.2, < 4.0)
45
51
  regexp_parser (>= 1.8, < 3.0)
46
52
  rexml (>= 3.2.5, < 4.0)
47
- rubocop-ast (>= 1.18.0, < 2.0)
53
+ rubocop-ast (>= 1.30.0, < 2.0)
48
54
  ruby-progressbar (~> 1.7)
49
- unicode-display_width (>= 1.4.0, < 3.0)
50
- rubocop-ast (1.18.0)
51
- parser (>= 3.1.1.0)
52
- ruby-next-core (0.15.1)
53
- ruby-progressbar (1.11.0)
54
- unicode-display_width (2.1.0)
55
- yabeda (0.11.0)
55
+ unicode-display_width (>= 2.4.0, < 3.0)
56
+ rubocop-ast (1.30.0)
57
+ parser (>= 3.2.1.0)
58
+ ruby-next-core (1.0.0)
59
+ ruby-progressbar (1.13.0)
60
+ unicode-display_width (2.5.0)
61
+ yabeda (0.12.0)
56
62
  anyway_config (>= 1.0, < 3)
57
63
  concurrent-ruby
58
64
  dry-initializer
@@ -70,4 +76,4 @@ DEPENDENCIES
70
76
  yabeda-gc!
71
77
 
72
78
  BUNDLED WITH
73
- 2.2.11
79
+ 2.5.3
data/README.md CHANGED
@@ -51,6 +51,8 @@ Or install it yourself as:
51
51
  | `compact_count` | Count of all GC compactions |
52
52
  | `read_barrier_faults` | The total number of times the read barrier was triggered during compaction (ruby 3+) |
53
53
  | `total_moved_objects` | The total number of objects compaction has moved (ruby 3+) |
54
+ | `marking_time` | The total time spent in marking phase (ruby 3.3+) |
55
+ | `sweeping_time` | The total time spent in sweeping phase (ruby 3.3+) |
54
56
 
55
57
  ## Development
56
58
 
@@ -58,6 +60,39 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
58
60
 
59
61
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
60
62
 
63
+ ## Releasing
64
+
65
+ 1. Bump version number in `lib/yabeda/gc/version.rb`
66
+
67
+ In case of pre-releases keep in mind [rubygems/rubygems#3086](https://github.com/rubygems/rubygems/issues/3086) and check version with command like `Gem::Version.new(Yabeda::gc::VERSION).to_s`
68
+
69
+ 2. Fill `CHANGELOG.md` with missing changes, add header with version and date.
70
+
71
+ 3. Make a commit:
72
+
73
+ ```sh
74
+ bundle # to update Gemfile.lock
75
+ git add lib/yabeda/gc/version.rb CHANGELOG.md Gemfile.lock
76
+ version=$(ruby -r ./lib/yabeda/gc/version.rb -e "puts Gem::Version.new(Yabeda::GC::VERSION)")
77
+ git commit --message="${version}: " --edit
78
+ ```
79
+
80
+ 4. Create annotated tag:
81
+
82
+ ```sh
83
+ git tag v${version} --annotate --message="${version}: " --edit --sign
84
+ ```
85
+
86
+ 5. Fill version name into subject line and (optionally) some description (list of changes will be taken from changelog and appended automatically)
87
+
88
+ 6. Push it:
89
+
90
+ ```sh
91
+ git push --follow-tags
92
+ ```
93
+
94
+ 7. GitHub Actions will create a new release, build and push gem into RubyGems! You're done!
95
+
61
96
  ## Contributing
62
97
 
63
98
  Bug reports and pull requests are welcome on GitHub at https://github.com/ianks/yabeda-gc. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/ianks/yabeda-gc/blob/master/CODE_OF_CONDUCT.md).
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Yabeda
4
4
  module GC
5
- VERSION = "0.2.1"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
data/lib/yabeda/gc.rb CHANGED
@@ -53,11 +53,18 @@ module Yabeda
53
53
 
54
54
  gauge :time, tags: [], comment: "The total time spent in garbage collections" if RUBY_VERSION >= "3.1"
55
55
 
56
+ if RUBY_VERSION >= "3.3"
57
+ gauge :marking_time, tags: [], comment: "Time spent in the marking phase"
58
+ gauge :sweeping_time, tags: [], comment: "Time spent in the sweeping phase"
59
+ end
60
+
56
61
  collect do
57
62
  stats = ::GC.stat
58
63
 
59
64
  stats.each do |stat_name, value|
60
- __send__("gc_#{stat_name}").set(EMPTY_HASH, value)
65
+ next unless ::Yabeda.gc.respond_to?(stat_name)
66
+
67
+ ::Yabeda.gc.__send__(stat_name).set(EMPTY_HASH, value)
61
68
  end
62
69
  end
63
70
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yabeda-gc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Ker-Seymer
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-22 00:00:00.000000000 Z
11
+ date: 2024-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yabeda
@@ -32,6 +32,7 @@ extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
34
  - ".github/workflows/lint.yml"
35
+ - ".github/workflows/release.yml"
35
36
  - ".github/workflows/test.yml"
36
37
  - ".gitignore"
37
38
  - ".rspec"
@@ -53,7 +54,7 @@ licenses:
53
54
  - MIT
54
55
  metadata:
55
56
  rubygems_mfa_required: 'true'
56
- post_install_message:
57
+ post_install_message:
57
58
  rdoc_options: []
58
59
  require_paths:
59
60
  - lib
@@ -68,8 +69,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
69
  - !ruby/object:Gem::Version
69
70
  version: '0'
70
71
  requirements: []
71
- rubygems_version: 3.3.7
72
- signing_key:
72
+ rubygems_version: 3.4.10
73
+ signing_key:
73
74
  specification_version: 4
74
75
  summary: Extensible Prometheus exporter for monitoring Ruby gargage collection
75
76
  test_files: []