yabeda 0.8.0 → 0.9.0

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: f7c6b79b60dd1c6ea62fe35f811be834bb64baecd5a7fcdfcd35b3f42415d45d
4
- data.tar.gz: 7f1d0130e059e95769e8a663edde3c05b0cc0a49f7af91e22a8ba2cf2a55027a
3
+ metadata.gz: 1a4867a0d04b93eebd708a3fcf4b21797194066c26e2a96809b85c2139926be9
4
+ data.tar.gz: 78a8e47cf194e30641c285505a199465518d5f6e0d1b73c07b4f4222bc2e5f31
5
5
  SHA512:
6
- metadata.gz: 40a72d78f2a675c8b0b1c476a9dd29345454a341e7cccbc5353862c4783b85f0825ee387a558547f5b796a126b2c229a6347f09bd1cde1c3935002dbabeea3a2
7
- data.tar.gz: 502631f8472f5f474c3cdbfac887e3e62015a6231246f84512b1251446a4f8913fb62a0cd97f7f6c4d60679318fcac421c9563397ec656f16b3fafc0c38b4f6f
6
+ metadata.gz: 9f05aeeec7451c222ebe6713da7ddca289b1922ff294f3acd0ad8350647e996173ac5c2a642445011cf8549cfc3db4e9a8d804ab74da4cc946e536b14ffa773e
7
+ data.tar.gz: d8e3b98d6889f4af3af3273c9e8abfc876b778eeb2bddd94babf9489dcb421d4ab5412f58b293026e6ecffc066ea3eaa42b6965192a5fa22b928a246e9a75de2
@@ -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-${{ steps.tag.outputs.version }}.gem > SHA256SUM
42
+ - name: Check version
43
+ run: ls -l yabeda-${{ 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-${{ steps.tag.outputs.version }}.gem
62
+ asset_name: yabeda-${{ 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-${{ 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-${{ steps.tag.outputs.version }}.gem
@@ -0,0 +1,46 @@
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
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ include:
19
+ - ruby: 3.0
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 Rubocop
44
+ run: bundle exec rubocop
45
+ - name: Run RSpec
46
+ run: bundle exec rspec
data/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
6
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## 0.9.0 - 2021-05-07
9
+
10
+ ### Added
11
+
12
+ - Ability to set global metric tags only for a specific group [#19](https://github.com/yabeda-rb/yabeda/pull/19) by [@liaden]
13
+
8
14
  ## 0.8.0 - 2020-08-21
9
15
 
10
16
  ### Added
@@ -99,3 +105,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99
105
  [@Envek]: https://github.com/Envek "Andrey Novikov"
100
106
  [@dsalahutdinov]: https://github.com/dsalahutdinov "Dmitry Salahutdinov"
101
107
  [@asusikov]: https://github.com/asusikov "Alexander Susikov"
108
+ [@liaden]: https://github.com/liaden "Joel Johnson"
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Yabeda
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/yabeda.svg)](https://rubygems.org/gems/yabeda) [![Build Status](https://travis-ci.org/yabeda-rb/yabeda.svg?branch=master)](https://travis-ci.org/yabeda-rb/yabeda)
3
+ [![Gem Version](https://badge.fury.io/rb/yabeda.svg)](https://rubygems.org/gems/yabeda)
4
4
 
5
5
  **This software is Work in Progress: features will appear and disappear, API will be changed, your feedback is always welcome!**
6
6
 
@@ -79,10 +79,14 @@ And then execute:
79
79
  end
80
80
  ```
81
81
 
82
- 5. _Optionally_ setup default tags that will be added to all metrics
82
+ 5. _Optionally_ setup default tags for all appropriate metrics
83
83
  ```ruby
84
84
  Yabeda.configure do
85
+ # matches all metrics in all groups
85
86
  default_tag :rails_environment, 'production'
87
+
88
+ # matches all metrics in the :your_app group
89
+ default_tag :tag_name, 'override', group: :your_app
86
90
  end
87
91
 
88
92
  # You can redefine them for limited amount of time
@@ -91,17 +95,58 @@ And then execute:
91
95
  end
92
96
  ```
93
97
 
94
- 6. See the docs for the adapter you're using
95
- 7. Enjoy!
98
+ **Note**: any usage of `with_tags` **must** have all those tags defined on all metrics that are generated in the block.
99
+
100
+ 6. _Optionally_ override default tags using precedence:
101
+
102
+ The tag precedence from high to low is:
103
+
104
+ * Manually specified tags
105
+ * Thread local tags (specified by `Yabeda.with_tags`)
106
+ * Group specific tags
107
+ * Global tags
108
+
109
+ 7. See the docs for the adapter you're using
110
+ 8. Enjoy!
96
111
 
97
112
  ## Available monitoring system adapters
98
113
 
99
- - [Prometheus](https://github.com/yabeda-rb/yabeda-prometheus)
114
+ ### Maintained by Yabeda
115
+
116
+ - Prometheus:
117
+ - [yabeda-prometheus](https://github.com/yabeda-rb/yabeda-prometheus) — wraps [official Ruby client for Prometheus](https://github.com/prometheus/client_ruby).
118
+ - [yabeda-prometheus-mmap](https://github.com/yabeda-rb/yabeda-prometheus-mmap) — wraps [GitLab's fork of Prometheus Ruby client](https://gitlab.com/gitlab-org/prometheus-client-mmap) which may work better for multi-process application servers.
100
119
  - [Datadog](https://github.com/yabeda-rb/yabeda-datadog)
101
120
  - [NewRelic](https://github.com/yabeda-rb/yabeda-newrelic)
121
+
122
+ ### Third-party adapters
123
+
124
+ These are developed and maintained by other awesome folks:
125
+
102
126
  - [Statsd](https://github.com/asusikov/yabeda-statsd)
103
127
  - _…and more! You can write your own adapter and open a pull request to add it into this list._
104
128
 
129
+ ## Available plugins to collect metrics
130
+
131
+ ### Maintained by Yabeda
132
+
133
+ - [yabeda-rails] — basic request metrics for [Ruby on Rails](https://rubyonrails.org/) applications.
134
+ - [yabeda-sidekiq] — comprehensive set of metrics for monitoring [Sidekiq](https://sidekiq.org/) jobs execution and queues.
135
+ - [yabeda-faktory] — metrics for monitoring jobs execution by Ruby workers of [Faktory](https://contribsys.com/faktory/).
136
+ - [yabeda-graphql] — metrics to query and field-level monitoring for apps using [GraphQL-Ruby](https://graphql-ruby.org/).
137
+ - [yabeda-puma-plugin] — metrics for internal state and performance of [Puma](https://puma.io/) application server.
138
+ - [yabeda-http_requests] — monitor how many outgoing HTTP calls your application does (uses [Sniffer](https://github.com/aderyabin/sniffer)).
139
+ - [yabeda-schked] — monitor number and duration of Cron jobs executed by [Schked](https://github.com/bibendi/schked).
140
+
141
+ ### Third-party plugins
142
+
143
+ These are developed and maintained by other awesome folks:
144
+
145
+ - [yabeda-grape](https://github.com/efigence/yabeda-grape) — metrics for [Grape](https://github.com/ruby-grape/grape) framework.
146
+ - [yabeda-gruf](https://github.com/Placewise/yabeda-gruf) — metrics for [gRPC Ruby Framework](https://github.com/bigcommerce/gruf)
147
+ - [yabeda-gc](https://github.com/ianks/yabeda-gc) — metrics for Ruby garbage collection.
148
+ - _…and more! You can write your own adapter and open a pull request to add it into this list._
149
+
105
150
  ## Roadmap (aka TODO or Help wanted)
106
151
 
107
152
  - Ability to change metric settings for individual adapters
@@ -130,6 +175,36 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
130
175
 
131
176
  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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
132
177
 
178
+ ### Releasing
179
+
180
+ 1. Bump version number in `lib/yabeda/version.rb`
181
+
182
+ 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::VERSION).to_s`
183
+
184
+ 2. Fill `CHANGELOG.md` with missing changes, add header with version and date.
185
+
186
+ 3. Make a commit:
187
+
188
+ ```sh
189
+ git add lib/yabeda/version.rb CHANGELOG.md
190
+ version=$(ruby -r ./lib/yabeda/version.rb -e "puts Gem::Version.new(Yabeda::VERSION)")
191
+ git commit --message="${version}: " --edit
192
+ ```
193
+
194
+ 3. Create annotated tag:
195
+
196
+ ```sh
197
+ git tag v${version} --annotate --message="${version}: " --edit --sign
198
+ ```
199
+
200
+ 4. Fill version name into subject line and (optionally) some description (changes will be taken from changelog and appended automatically)
201
+
202
+ 5. Push it:
203
+
204
+ ```sh
205
+ git push --follow-tags
206
+ ```
207
+
133
208
  ## Contributing
134
209
 
135
210
  Bug reports and pull requests are welcome on GitHub at https://github.com/yabeda-rb/yabeda.
@@ -139,3 +214,9 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/yabeda
139
214
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
140
215
 
141
216
  [yabeda-rails]: https://github.com/yabeda-rb/yabeda-rails/ "Yabeda plugin for collecting and exporting basic metrics for Rails applications"
217
+ [yabeda-sidekiq]: https://github.com/yabeda-rb/yabeda-sidekiq/ "Yabeda plugin for complete monitoring of Sidekiq metrics"
218
+ [yabeda-faktory]: https://github.com/yabeda-rb/yabeda-faktory/ "Yabeda plugin for complete monitoring of Faktory Ruby Workers"
219
+ [yabeda-graphql]: https://github.com/yabeda-rb/yabeda-graphql/ "Measure and understand how good your GraphQL-Ruby application works"
220
+ [yabeda-puma-plugin]: https://github.com/yabeda-rb/yabeda-puma-plugin/ "Collects Puma web-server metrics from puma control application"
221
+ [yabeda-http_requests]: https://github.com/yabeda-rb/yabeda-http_requests/ "Builtin metrics to monitor external HTTP requests"
222
+ [yabeda-schked]: https://github.com/yabeda-rb/yabeda-schked/ "Built-in metrics for monitoring Schked recurring jobs out of the box"
data/lib/yabeda.rb CHANGED
@@ -20,7 +20,9 @@ module Yabeda
20
20
 
21
21
  # @return [Hash<String, Yabeda::Group>] All registered metrics
22
22
  def groups
23
- @groups ||= Concurrent::Hash.new
23
+ @groups ||= Concurrent::Hash.new.tap do |hash|
24
+ hash[nil] = Yabeda::GlobalGroup.new(nil)
25
+ end
24
26
  end
25
27
 
26
28
  # @return [Hash<String, Yabeda::BaseAdapter>] All loaded adapters
@@ -33,7 +35,7 @@ module Yabeda
33
35
  @collectors ||= Concurrent::Array.new
34
36
  end
35
37
 
36
- # @return [Hash<Symbol, Symbol>] All added default tags
38
+ # @return [Hash<Symbol, Symbol>] All added global default tags
37
39
  def default_tags
38
40
  @default_tags ||= Concurrent::Hash.new
39
41
  end
@@ -86,14 +88,18 @@ module Yabeda
86
88
  # Forget all the configuration.
87
89
  # For testing purposes as it doesn't rollback changes in adapters.
88
90
  # @api private
91
+ # rubocop: disable Metrics/AbcSize
89
92
  def reset!
90
93
  default_tags.clear
91
94
  adapters.clear
92
- groups.clear
93
- metrics.clear
95
+ groups.each_key { |group| singleton_class.send(:remove_method, group) if group && respond_to?(group) }
96
+ @groups = nil
97
+ metrics.each_key { |metric| singleton_class.send(:remove_method, metric) if respond_to?(metric) }
98
+ @metrics = nil
94
99
  collectors.clear
95
100
  configurators.clear
96
101
  instance_variable_set(:@configured_by, nil)
97
102
  end
103
+ # rubocop: enable Metrics/AbcSize
98
104
  end
99
105
  end
@@ -4,7 +4,7 @@ module Yabeda
4
4
  # Growing-only counter
5
5
  class Counter < Metric
6
6
  def increment(tags, by: 1)
7
- all_tags = ::Yabeda::Tags.build(tags)
7
+ all_tags = ::Yabeda::Tags.build(tags, group)
8
8
  values[all_tags] += by
9
9
  ::Yabeda.adapters.each do |_, adapter|
10
10
  adapter.perform_counter_increment!(self, all_tags, by)
@@ -5,6 +5,7 @@ require "yabeda/counter"
5
5
  require "yabeda/gauge"
6
6
  require "yabeda/histogram"
7
7
  require "yabeda/group"
8
+ require "yabeda/global_group"
8
9
  require "yabeda/dsl/metric_builder"
9
10
 
10
11
  module Yabeda
@@ -30,6 +31,7 @@ module Yabeda
30
31
  # (like NewRelic) it is treated individually and has a special meaning.
31
32
  def group(group_name)
32
33
  @group = group_name
34
+ Yabeda.groups[@group] ||= Yabeda::Group.new(@group)
33
35
  return unless block_given?
34
36
 
35
37
  yield
@@ -58,24 +60,30 @@ module Yabeda
58
60
  #
59
61
  # @param name [Symbol] Name of default tag
60
62
  # @param value [String] Value of default tag
61
- def default_tag(name, value)
62
- ::Yabeda.default_tags[name] = value
63
+ def default_tag(name, value, group: @group)
64
+ if group
65
+ Yabeda.groups[group] ||= Yabeda::Group.new(group)
66
+ Yabeda.groups[group].default_tag(name, value)
67
+ else
68
+ Yabeda.default_tags[name] = value
69
+ end
63
70
  end
64
71
 
65
72
  # Redefine default tags for a limited amount of time
66
73
  # @param tags Hash{Symbol=>#to_s}
67
74
  def with_tags(**tags)
68
- Thread.current[:yabeda_temporary_tags] = tags
75
+ previous_temp_tags = temporary_tags
76
+ Thread.current[:yabeda_temporary_tags] = Thread.current[:yabeda_temporary_tags].merge(tags)
69
77
  yield
70
78
  ensure
71
- Thread.current[:yabeda_temporary_tags] = {}
79
+ Thread.current[:yabeda_temporary_tags] = previous_temp_tags
72
80
  end
73
81
 
74
82
  # Get tags set by +with_tags+
75
83
  # @api private
76
84
  # @return Hash
77
85
  def temporary_tags
78
- Thread.current[:yabeda_temporary_tags] || {}
86
+ Thread.current[:yabeda_temporary_tags] ||= {}
79
87
  end
80
88
 
81
89
  private
@@ -95,9 +103,10 @@ module Yabeda
95
103
  if group.nil?
96
104
  group = Group.new(metric.group)
97
105
  ::Yabeda.groups[metric.group] = group
98
- ::Yabeda.define_singleton_method(metric.group) { group }
99
106
  end
100
107
 
108
+ ::Yabeda.define_singleton_method(metric.group) { group } unless ::Yabeda.respond_to?(metric.group)
109
+
101
110
  group.register_metric(metric)
102
111
  end
103
112
  end
data/lib/yabeda/gauge.rb CHANGED
@@ -4,7 +4,7 @@ module Yabeda
4
4
  # Arbitrary value, can be changed in both sides
5
5
  class Gauge < Metric
6
6
  def set(tags, value)
7
- all_tags = ::Yabeda::Tags.build(tags)
7
+ all_tags = ::Yabeda::Tags.build(tags, group)
8
8
  values[all_tags] = value
9
9
  ::Yabeda.adapters.each do |_, adapter|
10
10
  adapter.perform_gauge_set!(self, all_tags, value)
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "forwardable"
4
+ require_relative "./group"
5
+
6
+ module Yabeda
7
+ # Represents implicit global group
8
+ class GlobalGroup < Group
9
+ extend Forwardable
10
+
11
+ def_delegators ::Yabeda, :default_tags, :default_tag
12
+ end
13
+ end
data/lib/yabeda/group.rb CHANGED
@@ -9,6 +9,16 @@ module Yabeda
9
9
 
10
10
  param :name
11
11
 
12
+ def default_tags
13
+ @default_tags ||= Concurrent::Hash.new
14
+ ::Yabeda.default_tags.merge(@default_tags)
15
+ end
16
+
17
+ def default_tag(key, value)
18
+ @default_tags ||= Concurrent::Hash.new
19
+ @default_tags[key] = value
20
+ end
21
+
12
22
  def register_metric(metric)
13
23
  define_singleton_method(metric.name) { metric }
14
24
  end
@@ -7,7 +7,7 @@ module Yabeda
7
7
  option :buckets
8
8
 
9
9
  def measure(tags, value)
10
- all_tags = ::Yabeda::Tags.build(tags)
10
+ all_tags = ::Yabeda::Tags.build(tags, group)
11
11
  values[all_tags] = value
12
12
  ::Yabeda.adapters.each do |_, adapter|
13
13
  adapter.perform_histogram_measure!(self, all_tags, value)
data/lib/yabeda/metric.rb CHANGED
@@ -17,15 +17,17 @@ module Yabeda
17
17
 
18
18
  # Returns the value for the given label set
19
19
  def get(labels = {})
20
- values[::Yabeda::Tags.build(labels)]
20
+ values[::Yabeda::Tags.build(labels, group)]
21
21
  end
22
22
 
23
23
  def values
24
24
  @values ||= Concurrent::Hash.new
25
25
  end
26
26
 
27
+ # Returns allowed tags for metric (with account for global and group-level +default_tags+)
28
+ # @return Array<Symbol>
27
29
  def tags
28
- (Yabeda.default_tags.keys + Array(super)).uniq
30
+ (Yabeda.groups[group].default_tags.keys + Array(super)).uniq
29
31
  end
30
32
  end
31
33
  end
data/lib/yabeda/tags.rb CHANGED
@@ -3,8 +3,12 @@
3
3
  module Yabeda
4
4
  # Class to merge tags
5
5
  class Tags
6
- def self.build(tags)
7
- ::Yabeda.default_tags.merge(Yabeda.temporary_tags).merge(tags)
6
+ def self.build(tags, group_name = nil)
7
+ Yabeda.default_tags.dup.tap do |result|
8
+ result.merge!(Yabeda.groups[group_name].default_tags) if group_name
9
+ result.merge!(Yabeda.temporary_tags)
10
+ result.merge!(tags)
11
+ end
8
12
  end
9
13
  end
10
14
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Yabeda
4
- VERSION = "0.8.0"
4
+ VERSION = "0.9.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yabeda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Novikov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-21 00:00:00.000000000 Z
11
+ date: 2021-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -111,17 +111,18 @@ dependencies:
111
111
  description: 'Collect statistics about how your application is performing with ease.
112
112
  Export metrics to various monitoring systems.
113
113
 
114
- '
114
+ '
115
115
  email:
116
116
  - envek@envek.name
117
117
  executables: []
118
118
  extensions: []
119
119
  extra_rdoc_files: []
120
120
  files:
121
+ - ".github/workflows/build-release.yml"
122
+ - ".github/workflows/test.yml"
121
123
  - ".gitignore"
122
124
  - ".rspec"
123
125
  - ".rubocop.yml"
124
- - ".travis.yml"
125
126
  - ".yardopts"
126
127
  - CHANGELOG.md
127
128
  - Gemfile
@@ -139,6 +140,7 @@ files:
139
140
  - lib/yabeda/dsl/option_builder.rb
140
141
  - lib/yabeda/errors.rb
141
142
  - lib/yabeda/gauge.rb
143
+ - lib/yabeda/global_group.rb
142
144
  - lib/yabeda/group.rb
143
145
  - lib/yabeda/histogram.rb
144
146
  - lib/yabeda/metric.rb
@@ -165,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
167
  - !ruby/object:Gem::Version
166
168
  version: '0'
167
169
  requirements: []
168
- rubygems_version: 3.1.2
170
+ rubygems_version: 3.1.6
169
171
  signing_key:
170
172
  specification_version: 4
171
173
  summary: Extensible framework for collecting metric for your Ruby application
data/.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.7.0
6
- - 2.6.5
7
- - 2.5.7
8
- - 2.4.9
9
- before_install: gem install bundler -v "~> 2.0"