yabeda-puma-plugin 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build-release.yml +54 -0
- data/.github/workflows/test.yml +44 -0
- data/lib/puma/plugin/yabeda_prometheus.rb +13 -11
- data/lib/yabeda/puma/plugin/version.rb +1 -1
- data/yabeda-puma-plugin.gemspec +1 -1
- metadata +7 -6
- data/.travis.yml +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea655ec09c4edd3459d19356df62760dbb70049b24a0e5ccfb69eed7d501ec7d
|
4
|
+
data.tar.gz: 49cab44b0913f02a372473b3e8951a6c880020f3a22970c6f9cdadee7d3935ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d68acb875bb1d793d0bf6c11f1df91313ec730bcf9984f362829586bdb7810e21b809c60980cf606feec93378957b218d046bb30ced55858f8cc704c3b073380
|
7
|
+
data.tar.gz: e8e0c33afd4c639ef3abb25485bf2fb9a3598a288d07033ad64ebffd354335f17558aef856afc18d439fb03cf0c767026c9e348b31de6d1ff1cc91a653ca1c7e
|
@@ -0,0 +1,54 @@
|
|
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
|
+
# Multiline body for release. See https://github.community/t/set-output-truncates-multiline-strings/16852/5
|
25
|
+
BODY="$(git for-each-ref $GITHUB_REF --format='%(contents:body)')"
|
26
|
+
BODY="${BODY//'%'/'%25'}"
|
27
|
+
BODY="${BODY//$'\n'/'%0A'}"
|
28
|
+
BODY="${BODY//$'\r'/'%0D'}"
|
29
|
+
echo "::set-output name=body::$BODY"
|
30
|
+
- name: Build gem
|
31
|
+
run: gem build
|
32
|
+
- name: Check version
|
33
|
+
run: ls yabeda-puma-plugin-${{ steps.tag.outputs.version }}.gem
|
34
|
+
- name: Create Release
|
35
|
+
id: create_release
|
36
|
+
uses: actions/create-release@v1
|
37
|
+
env:
|
38
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
39
|
+
with:
|
40
|
+
tag_name: ${{ github.ref }}
|
41
|
+
release_name: ${{ steps.tag.outputs.subject }}
|
42
|
+
body: ${{ steps.tag.outputs.body }}
|
43
|
+
draft: false
|
44
|
+
prerelease: false
|
45
|
+
- name: Upload Release Asset
|
46
|
+
id: upload-release-asset
|
47
|
+
uses: actions/upload-release-asset@v1
|
48
|
+
env:
|
49
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
50
|
+
with:
|
51
|
+
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
52
|
+
asset_path: yabeda-puma-plugin-${{ steps.tag.outputs.version }}.gem
|
53
|
+
asset_name: yabeda-puma-plugin-${{ steps.tag.outputs.version }}.gem
|
54
|
+
asset_content_type: application/x-tar
|
@@ -0,0 +1,44 @@
|
|
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(toJSON(github.event.commits.latest.message), '[ci skip]')"
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
strategy:
|
17
|
+
fail-fast: false
|
18
|
+
matrix:
|
19
|
+
include:
|
20
|
+
- ruby: 2.7
|
21
|
+
- ruby: 2.6
|
22
|
+
- ruby: 2.5
|
23
|
+
container:
|
24
|
+
image: ruby:${{ matrix.ruby }}
|
25
|
+
env:
|
26
|
+
CI: true
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v2
|
29
|
+
- uses: actions/cache@v2
|
30
|
+
with:
|
31
|
+
path: vendor/bundle
|
32
|
+
key: bundle-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/Gemfile') }}
|
33
|
+
restore-keys: |
|
34
|
+
bundle-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/Gemfile') }}
|
35
|
+
bundle-${{ matrix.ruby }}-
|
36
|
+
- name: Upgrade Bundler to 2.0 (for older Rubies)
|
37
|
+
run: gem install bundler -v '~> 2.0'
|
38
|
+
- name: Bundle install
|
39
|
+
run: |
|
40
|
+
bundle config path vendor/bundle
|
41
|
+
bundle install
|
42
|
+
bundle update
|
43
|
+
- name: Run RSpec
|
44
|
+
run: bundle exec rspec
|
@@ -27,21 +27,23 @@ Puma::Plugin.create do
|
|
27
27
|
port = Integer(ENV.fetch('PROMETHEUS_EXPORTER_PORT', uri.port))
|
28
28
|
path = ENV.fetch('PROMETHEUS_EXPORTER_PATH', uri.path)
|
29
29
|
|
30
|
-
|
30
|
+
events.on_booted do
|
31
|
+
app = Yabeda::Prometheus::Exporter.rack_app(Yabeda::Prometheus::Exporter, path: path)
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
33
|
+
metrics = Puma::Server.new app, events
|
34
|
+
metrics.min_threads = 0
|
35
|
+
metrics.max_threads = 1
|
35
36
|
|
36
|
-
|
37
|
-
|
37
|
+
events.log "* Starting Yabeda Prometheus metrics exporter on http://#{host}:#{port}#{path}"
|
38
|
+
metrics.add_tcp_listener host, port
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
events.register(:state) do |state|
|
41
|
+
if %i[halt restart stop].include?(state)
|
42
|
+
metrics.stop(true) unless metrics.shutting_down?
|
43
|
+
end
|
42
44
|
end
|
43
|
-
end
|
44
45
|
|
45
|
-
|
46
|
+
metrics.run
|
47
|
+
end
|
46
48
|
end
|
47
49
|
end
|
data/yabeda-puma-plugin.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_runtime_dependency "json"
|
27
27
|
|
28
28
|
spec.add_development_dependency "bundler"
|
29
|
-
spec.add_development_dependency "rake", "~>
|
29
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
30
30
|
spec.add_development_dependency "rspec", "~> 3.0"
|
31
31
|
spec.add_development_dependency "rack"
|
32
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yabeda-puma-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Salahutdinov Dmitry
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yabeda
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '13.0'
|
76
76
|
type: :development
|
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: '
|
82
|
+
version: '13.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,9 +115,10 @@ executables: []
|
|
115
115
|
extensions: []
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
|
+
- ".github/workflows/build-release.yml"
|
119
|
+
- ".github/workflows/test.yml"
|
118
120
|
- ".gitignore"
|
119
121
|
- ".rspec"
|
120
|
-
- ".travis.yml"
|
121
122
|
- Gemfile
|
122
123
|
- LICENSE
|
123
124
|
- LICENSE.txt
|
@@ -155,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
156
|
- !ruby/object:Gem::Version
|
156
157
|
version: '0'
|
157
158
|
requirements: []
|
158
|
-
rubygems_version: 3.
|
159
|
+
rubygems_version: 3.1.4
|
159
160
|
signing_key:
|
160
161
|
specification_version: 4
|
161
162
|
summary: Puma web server plugin for collecting puma metrics with Yabeda framework.
|