yabeda-prometheus 0.6.1 → 0.6.2
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/.github/workflows/build-release.yml +82 -0
- data/.github/workflows/test.yml +45 -0
- data/README.md +33 -1
- data/lib/yabeda/prometheus/exporter.rb +4 -4
- data/lib/yabeda/prometheus/version.rb +1 -1
- data/yabeda-prometheus-logo.png +0 -0
- data/yabeda-prometheus.gemspec +2 -2
- metadata +10 -8
- data/.travis.yml +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec39031cd5a8edd3f8ab3badfac7568683e2d15dd84eb2adfacd0953af9a4f1b
|
4
|
+
data.tar.gz: 68e2c9f81ab756ff009ce0d3e638cf6391fe7e7d9a02ee482857843462db66a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 267557ee543e48873693cfb61c31e1e535f75c0947355f3d613aac372b132848b481a5aa03fe9d1f0c2709b34482df189dd28a18039d84023384ee61016b6d52
|
7
|
+
data.tar.gz: f32dfd90a9814d1eef154cb36486029467d22792cd21d63dc57f9bc3028f87d2f4d939429d58a75fb6fc8e5cffd5d3d56aaa0da2f663e868c3c6d8e3c8e4be25
|
@@ -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-${{ steps.tag.outputs.version }}.gem > SHA256SUM
|
42
|
+
- name: Check version
|
43
|
+
run: ls -l yabeda-prometheus-${{ 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-${{ steps.tag.outputs.version }}.gem
|
62
|
+
asset_name: yabeda-prometheus-${{ 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-${{ 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-${{ steps.tag.outputs.version }}.gem
|
@@ -0,0 +1,45 @@
|
|
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 RSpec
|
45
|
+
run: bundle exec rspec
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Yabeda::
|
1
|
+
# 
|
2
2
|
|
3
3
|
[](https://rubygems.org/gems/yabeda-prometheus)
|
4
4
|
|
@@ -96,6 +96,38 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
96
96
|
|
97
97
|
Bug reports and pull requests are welcome on GitHub at https://github.com/yabeda-rb/yabeda-prometheus.
|
98
98
|
|
99
|
+
### Releasing
|
100
|
+
|
101
|
+
1. Bump version number in `lib/yabeda/prometheus/version.rb`
|
102
|
+
|
103
|
+
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::VERSION).to_s`
|
104
|
+
|
105
|
+
2. Fill `CHANGELOG.md` with missing changes, add header with version and date.
|
106
|
+
|
107
|
+
3. Make a commit:
|
108
|
+
|
109
|
+
```sh
|
110
|
+
git add lib/yabeda/prometheus/version.rb CHANGELOG.md
|
111
|
+
version=$(ruby -r ./lib/yabeda/prometheus/version.rb -e "puts Gem::Version.new(Yabeda::Prometheus::VERSION)")
|
112
|
+
git commit --message="${version}: " --edit
|
113
|
+
```
|
114
|
+
|
115
|
+
4. Create annotated tag:
|
116
|
+
|
117
|
+
```sh
|
118
|
+
git tag v${version} --annotate --message="${version}: " --edit --sign
|
119
|
+
```
|
120
|
+
|
121
|
+
5. Fill version name into subject line and (optionally) some description (list of changes will be taken from changelog and appended automatically)
|
122
|
+
|
123
|
+
6. Push it:
|
124
|
+
|
125
|
+
```sh
|
126
|
+
git push --follow-tags
|
127
|
+
```
|
128
|
+
|
129
|
+
7. GitHub Actions will create a new release, build and push gem into RubyGems! You're done!
|
130
|
+
|
99
131
|
## License
|
100
132
|
|
101
133
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -21,7 +21,7 @@ module Yabeda
|
|
21
21
|
def start_metrics_server!
|
22
22
|
Thread.new do
|
23
23
|
default_port = ENV.fetch("PORT", 9394)
|
24
|
-
Rack::Handler::WEBrick.run(
|
24
|
+
::Rack::Handler::WEBrick.run(
|
25
25
|
rack_app,
|
26
26
|
Host: ENV["PROMETHEUS_EXPORTER_BIND"] || "0.0.0.0",
|
27
27
|
Port: ENV.fetch("PROMETHEUS_EXPORTER_PORT", default_port),
|
@@ -31,9 +31,9 @@ module Yabeda
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def rack_app(exporter = self, path: "/metrics")
|
34
|
-
Rack::Builder.new do
|
35
|
-
use Rack::CommonLogger
|
36
|
-
use Rack::ShowExceptions
|
34
|
+
::Rack::Builder.new do
|
35
|
+
use ::Rack::CommonLogger
|
36
|
+
use ::Rack::ShowExceptions
|
37
37
|
use exporter, path: path
|
38
38
|
run NOT_FOUND_HANDLER
|
39
39
|
end
|
Binary file
|
data/yabeda-prometheus.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_dependency "yabeda", "~> 0.5"
|
32
32
|
spec.add_dependency "rack"
|
33
33
|
|
34
|
-
spec.add_development_dependency "bundler", "~>
|
35
|
-
spec.add_development_dependency "rake", "~>
|
34
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
35
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
36
36
|
spec.add_development_dependency "rspec", "~> 3.0"
|
37
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yabeda-prometheus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Novikov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prometheus-client
|
@@ -64,28 +64,28 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '2.0'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
74
|
+
version: '2.0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: rake
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
81
|
+
version: '13.0'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
88
|
+
version: '13.0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: rspec
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,10 +107,11 @@ executables: []
|
|
107
107
|
extensions: []
|
108
108
|
extra_rdoc_files: []
|
109
109
|
files:
|
110
|
+
- ".github/workflows/build-release.yml"
|
111
|
+
- ".github/workflows/test.yml"
|
110
112
|
- ".gitignore"
|
111
113
|
- ".rspec"
|
112
114
|
- ".rubocop.yml"
|
113
|
-
- ".travis.yml"
|
114
115
|
- CHANGELOG.md
|
115
116
|
- Gemfile
|
116
117
|
- LICENSE.txt
|
@@ -122,6 +123,7 @@ files:
|
|
122
123
|
- lib/yabeda/prometheus/adapter.rb
|
123
124
|
- lib/yabeda/prometheus/exporter.rb
|
124
125
|
- lib/yabeda/prometheus/version.rb
|
126
|
+
- yabeda-prometheus-logo.png
|
125
127
|
- yabeda-prometheus.gemspec
|
126
128
|
homepage: https://github.com/yabeda-rb/yabeda-prometheus
|
127
129
|
licenses:
|
@@ -145,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
147
|
- !ruby/object:Gem::Version
|
146
148
|
version: '0'
|
147
149
|
requirements: []
|
148
|
-
rubygems_version: 3.
|
150
|
+
rubygems_version: 3.1.6
|
149
151
|
signing_key:
|
150
152
|
specification_version: 4
|
151
153
|
summary: Extensible Prometheus exporter for your application
|