yabeda-prometheus-mmap 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a4b12a39360e1ca4b9f1d849bee55f6022f904f444197e3e11776d3c35d10e5
4
- data.tar.gz: 443b04248da339a56b1e37476e52a11ac6a1240cd1216102e994142902304cf0
3
+ metadata.gz: 73d01a0f121f5146808f3f97a1fb089ccaaffedcaeda142549af989cb55496c1
4
+ data.tar.gz: a513b29dba8f2406c3e0888e36ccd4a7445040b55602abf29211b15a66776d48
5
5
  SHA512:
6
- metadata.gz: f72aa5a161e28a3a050a605ea39db45cd903fd5d24306a1fff778fffe829f304240b92e9e838258bbe9b1a90301dabc7f4c730f73f77845c5424116d87de0afb
7
- data.tar.gz: 2f52032cc8f4dad25227d18a88184622a6b7d3c902a7bf823a189ef28791369473cd5e5dcbf6694bdcc0a7e14ba2e07518ede35e197e6d65ba10d634f3076986
6
+ metadata.gz: 77b401497bdead3aef26fdcd217d9b25bcb6265140c754b1491a3f28d8dff9d2443b1eb41f9198e3997c12293e88e8011c2d5d2b04fa1a3a468583c920d11c0e
7
+ data.tar.gz: 617deebd2f04b5ec0397c671047e9c0391619ec2830f17749e40e0075d904ce4a0508bfe0c612f97c3cb322b4891f43fcbd6a875685de5c59ca80d09dd9cee38
@@ -0,0 +1,82 @@
1
+ name: Build and release gem to RubyGems
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - v*
7
+
8
+ jobs:
9
+ release:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+ with:
14
+ fetch-depth: 0 # Fetch current tag as annotated. See https://github.com/actions/checkout/issues/290
15
+ - uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: 2.7
18
+ - name: "Extract data from tag: version, message, body"
19
+ id: tag
20
+ run: |
21
+ git fetch --tags --force # Really fetch annotated tag. See https://github.com/actions/checkout/issues/290#issuecomment-680260080
22
+ echo ::set-output name=version::${GITHUB_REF#refs/tags/v}
23
+ echo ::set-output name=subject::$(git for-each-ref $GITHUB_REF --format='%(contents:subject)')
24
+ BODY="$(git for-each-ref $GITHUB_REF --format='%(contents:body)')"
25
+ # Extract changelog entries between this and previous version headers
26
+ escaped_version=$(echo ${GITHUB_REF#refs/tags/v} | sed -e 's/[]\/$*.^[]/\\&/g')
27
+ changelog=$(awk "BEGIN{inrelease=0} /## ${escaped_version}/{inrelease=1;next} /## [0-9]+\.[0-9]+\.[0-9]+/{inrelease=0;exit} {if (inrelease) print}" CHANGELOG.md)
28
+ # Multiline body for release. See https://github.community/t/set-output-truncates-multiline-strings/16852/5
29
+ BODY="${BODY}"$'\n'"${changelog}"
30
+ BODY="${BODY//'%'/'%25'}"
31
+ BODY="${BODY//$'\n'/'%0A'}"
32
+ BODY="${BODY//$'\r'/'%0D'}"
33
+ echo "::set-output name=body::$BODY"
34
+ # Add pre-release option if tag name has any suffix after vMAJOR.MINOR.PATCH
35
+ if [[ ${GITHUB_REF#refs/tags/} =~ ^v[0-9]+\.[0-9]+\.[0-9]+.+ ]]; then
36
+ echo ::set-output name=prerelease::true
37
+ fi
38
+ - name: Build gem
39
+ run: gem build
40
+ - name: Calculate checksums
41
+ run: sha256sum yabeda-prometheus-mmap-${{ steps.tag.outputs.version }}.gem > SHA256SUM
42
+ - name: Check version
43
+ run: ls -l yabeda-prometheus-mmap-${{ steps.tag.outputs.version }}.gem
44
+ - name: Create Release
45
+ id: create_release
46
+ uses: actions/create-release@v1
47
+ env:
48
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49
+ with:
50
+ tag_name: ${{ github.ref }}
51
+ release_name: ${{ steps.tag.outputs.subject }}
52
+ body: ${{ steps.tag.outputs.body }}
53
+ draft: false
54
+ prerelease: ${{ steps.tag.outputs.prerelease }}
55
+ - name: Upload built gem as release asset
56
+ uses: actions/upload-release-asset@v1
57
+ env:
58
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59
+ with:
60
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
61
+ asset_path: yabeda-prometheus-mmap-${{ steps.tag.outputs.version }}.gem
62
+ asset_name: yabeda-prometheus-mmap-${{ steps.tag.outputs.version }}.gem
63
+ asset_content_type: application/x-tar
64
+ - name: Upload checksums as release asset
65
+ uses: actions/upload-release-asset@v1
66
+ env:
67
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68
+ with:
69
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
70
+ asset_path: SHA256SUM
71
+ asset_name: SHA256SUM
72
+ asset_content_type: text/plain
73
+ - name: Publish to GitHub packages
74
+ env:
75
+ GEM_HOST_API_KEY: Bearer ${{ secrets.GITHUB_TOKEN }}
76
+ run: |
77
+ gem push yabeda-prometheus-mmap-${{ steps.tag.outputs.version }}.gem --host https://rubygems.pkg.github.com/${{ github.repository_owner }}
78
+ - name: Publish to RubyGems
79
+ env:
80
+ GEM_HOST_API_KEY: "${{ secrets.RUBYGEMS_API_KEY }}"
81
+ run: |
82
+ gem push yabeda-prometheus-mmap-${{ steps.tag.outputs.version }}.gem
@@ -0,0 +1,47 @@
1
+ name: Run tests
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - '**'
8
+ tags-ignore:
9
+ - 'v*'
10
+
11
+ jobs:
12
+ test:
13
+ name: "Run tests"
14
+ if: "!contains(github.event.head_commit.message, '[ci skip]')"
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ include:
20
+ - ruby: 3.0
21
+ - ruby: 2.7
22
+ - ruby: 2.6
23
+ - ruby: 2.5
24
+ container:
25
+ image: ruby:${{ matrix.ruby }}
26
+ env:
27
+ CI: true
28
+ steps:
29
+ - uses: actions/checkout@v2
30
+ - uses: actions/cache@v2
31
+ with:
32
+ path: vendor/bundle
33
+ key: bundle-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/Gemfile') }}
34
+ restore-keys: |
35
+ bundle-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/Gemfile') }}
36
+ bundle-${{ matrix.ruby }}-
37
+ - name: Upgrade Bundler to 2.0 (for older Rubies)
38
+ run: gem install bundler -v '~> 2.0'
39
+ - name: Bundle install
40
+ run: |
41
+ bundle config path vendor/bundle
42
+ bundle install
43
+ bundle update
44
+ - name: Run Rubocop
45
+ run: bundle exec rubocop
46
+ - name: Run RSpec
47
+ run: bundle exec rspec
data/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
+
8
+ ## 0.1.1 - 2020-08-04
9
+
10
+ ### Fixed
11
+
12
+ - Fix mounting exporter in Rails routes. [#3](https://github.com/yabeda-rb/yabeda-prometheus-mmap/pull/3) by [@macchiang][]
13
+
14
+ ## 0.1.0 - 2020-03-25
15
+
16
+ Initial release. [@dsalahutdinov][]
17
+
18
+ [@macchiang]: https://github.com/macchiang "Mac"
19
+ [@dsalahutdinov]: https://github.com/dsalahutdinov "Salahutdinov Dmitry"
data/Gemfile CHANGED
@@ -9,4 +9,4 @@ gem 'byebug'
9
9
  gem 'rack'
10
10
  gem 'rake', '~> 12.0'
11
11
  gem 'rspec', '~> 3.0'
12
- gem 'rubocop'
12
+ gem 'rubocop', '~> 0.81.0'
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  alt="Sponsored by Amplifr" src="https://amplifr-direct.s3-eu-west-1.amazonaws.com/social_images/image/37b580d9-3668-4005-8d5a-137de3a3e77c.png" />
4
4
  </a>
5
5
 
6
- # Yabeda::[Prometheus]::Mmap
6
+ # ![`Yabeda::Prometheus::Mmap`](./yabeda-prometheus-mmap-logo.png)
7
7
 
8
8
 
9
9
  Adapter for easy exporting your collected metrics from your application to the [Prometheus]!
@@ -68,6 +68,38 @@ docker-compose run app bundle exec rspec
68
68
 
69
69
  Bug reports and pull requests are welcome on GitHub at https://github.com/yabeda-rb/yabeda-prometheus-mmap.
70
70
 
71
+ ### Releasing
72
+
73
+ 1. Bump version number in `lib/yabeda/prometheus/mmap/version.rb`
74
+
75
+ 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::Prometheus::Mmap::VERSION).to_s`
76
+
77
+ 2. Fill `CHANGELOG.md` with missing changes, add header with version and date.
78
+
79
+ 3. Make a commit:
80
+
81
+ ```sh
82
+ git add lib/yabeda/prometheus/mmap/version.rb CHANGELOG.md
83
+ version=$(ruby -r ./lib/yabeda/prometheus/mmap/version.rb -e "puts Gem::Version.new(Yabeda::Prometheus::Mmap::VERSION)")
84
+ git commit --message="${version}: " --edit
85
+ ```
86
+
87
+ 4. Create annotated tag:
88
+
89
+ ```sh
90
+ git tag v${version} --annotate --message="${version}: " --edit --sign
91
+ ```
92
+
93
+ 5. Fill version name into subject line and (optionally) some description (list of changes will be taken from changelog and appended automatically)
94
+
95
+ 6. Push it:
96
+
97
+ ```sh
98
+ git push --follow-tags
99
+ ```
100
+
101
+ 7. GitHub Actions will create a new release, build and push gem into RubyGems! You're done!
102
+
71
103
  ## License
72
104
 
73
105
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -23,7 +23,7 @@ module Yabeda
23
23
  def start_metrics_server!
24
24
  Thread.new do
25
25
  default_port = ENV.fetch('PORT', 9394)
26
- Rack::Handler::WEBrick.run(
26
+ ::Rack::Handler::WEBrick.run(
27
27
  rack_app,
28
28
  Host: ENV['PROMETHEUS_EXPORTER_BIND'] || '0.0.0.0',
29
29
  Port: ENV.fetch('PROMETHEUS_EXPORTER_PORT', default_port),
@@ -33,9 +33,9 @@ module Yabeda
33
33
  end
34
34
 
35
35
  def rack_app(exporter = self, path: '/metrics')
36
- Rack::Builder.new do
37
- use Rack::CommonLogger
38
- use Rack::ShowExceptions
36
+ ::Rack::Builder.new do
37
+ use ::Rack::CommonLogger
38
+ use ::Rack::ShowExceptions
39
39
  use exporter, path: path
40
40
  run NOT_FOUND_HANDLER
41
41
  end
@@ -3,7 +3,7 @@
3
3
  module Yabeda
4
4
  module Prometheus
5
5
  module Mmap
6
- VERSION = '0.1.1'
6
+ VERSION = '0.1.2'
7
7
  end
8
8
  end
9
9
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yabeda-prometheus-mmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Salahutdinov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-05 00:00:00.000000000 Z
11
+ date: 2021-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prometheus-client-mmap
@@ -45,9 +45,11 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - ".github/workflows/build-release.yml"
49
+ - ".github/workflows/test.yml"
48
50
  - ".gitignore"
49
51
  - ".rspec"
50
- - ".travis.yml"
52
+ - CHANGELOG.md
51
53
  - Gemfile
52
54
  - LICENSE.txt
53
55
  - README.md
@@ -60,6 +62,7 @@ files:
60
62
  - lib/yabeda/prometheus/mmap/adapter.rb
61
63
  - lib/yabeda/prometheus/mmap/exporter.rb
62
64
  - lib/yabeda/prometheus/mmap/version.rb
65
+ - yabeda-prometheus-mmap-logo.png
63
66
  - yabeda-prometheus-mmap.gemspec
64
67
  homepage: https://github.com/yabeda-rb/yabeda-prometheus-mmap
65
68
  licenses:
@@ -83,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
86
  - !ruby/object:Gem::Version
84
87
  version: '0'
85
88
  requirements: []
86
- rubygems_version: 3.1.2
89
+ rubygems_version: 3.1.6
87
90
  signing_key:
88
91
  specification_version: 4
89
92
  summary: Extensible Prometheus exporter for your application
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.7.0
6
- before_install: gem install bundler -v 2.1.2