yabeda 0.5.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -4
- data/.travis.yml +0 -1
- data/CHANGELOG.md +41 -1
- data/Gemfile +1 -1
- data/README.md +14 -1
- data/lib/yabeda.rb +11 -0
- data/lib/yabeda/dsl/class_methods.rb +17 -1
- data/lib/yabeda/gauge.rb +8 -0
- data/lib/yabeda/metric.rb +1 -1
- data/lib/yabeda/railtie.rb +11 -0
- data/lib/yabeda/tags.rb +1 -1
- data/lib/yabeda/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7c6b79b60dd1c6ea62fe35f811be834bb64baecd5a7fcdfcd35b3f42415d45d
|
4
|
+
data.tar.gz: 7f1d0130e059e95769e8a663edde3c05b0cc0a49f7af91e22a8ba2cf2a55027a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40a72d78f2a675c8b0b1c476a9dd29345454a341e7cccbc5353862c4783b85f0825ee387a558547f5b796a126b2c229a6347f09bd1cde1c3935002dbabeea3a2
|
7
|
+
data.tar.gz: 502631f8472f5f474c3cdbfac887e3e62015a6231246f84512b1251446a4f8913fb62a0cd97f7f6c4d60679318fcac421c9563397ec656f16b3fafc0c38b4f6f
|
data/.rubocop.yml
CHANGED
@@ -10,12 +10,9 @@ Metrics/BlockLength:
|
|
10
10
|
- "Gemfile"
|
11
11
|
- "spec/**/*"
|
12
12
|
|
13
|
-
|
13
|
+
Layout/LineLength:
|
14
14
|
Max: 120
|
15
15
|
|
16
|
-
Style/BracesAroundHashParameters:
|
17
|
-
EnforcedStyle: context_dependent
|
18
|
-
|
19
16
|
Style/StringLiterals:
|
20
17
|
EnforcedStyle: double_quotes
|
21
18
|
|
@@ -47,3 +44,11 @@ Style/TrailingCommaInHashLiteral:
|
|
47
44
|
Enabled: true
|
48
45
|
EnforcedStyleForMultiline: consistent_comma
|
49
46
|
|
47
|
+
Style/HashEachMethods:
|
48
|
+
Enabled: true
|
49
|
+
|
50
|
+
Style/HashTransformKeys:
|
51
|
+
Enabled: true
|
52
|
+
|
53
|
+
Style/HashTransformValues:
|
54
|
+
Enabled: true
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,45 @@ 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.8.0 - 2020-08-21
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- Added railtie to automatically configure Yabeda on Rails: moved from [yabeda-rails](https://github.com/yabeda-rb/yabeda-rails) gem. [@Envek]
|
13
|
+
|
14
|
+
## 0.7.0 - 2020-08-07
|
15
|
+
|
16
|
+
### Added
|
17
|
+
|
18
|
+
- `#increment` and `#decrement` convenience methods for `Yabeda::Gauge`. [#13](https://github.com/yabeda-rb/yabeda/pull/13) by [@dsalahutdinov]
|
19
|
+
- Ability to use custom step in `#increment` and `#decrement` for gauges. [@Envek]
|
20
|
+
|
21
|
+
### Fixed
|
22
|
+
|
23
|
+
- Account for default tags in `Yabeda::Metric#get`. [@Envek]
|
24
|
+
|
25
|
+
## 0.6.2 - 2020-08-04
|
26
|
+
|
27
|
+
### Fixed
|
28
|
+
|
29
|
+
- Compatibility with plugins (like [yabeda-puma-plugin](https://github.com/yabeda-rb/yabeda-puma-plugin)) that for some reason configures itself after Yabeda configuration was already applied by `Yabeda.configure!` (was broken in 0.6.0). [@Envek]
|
30
|
+
|
31
|
+
## 0.6.1 - 2020-07-16
|
32
|
+
|
33
|
+
### Fixed
|
34
|
+
|
35
|
+
- Compatibility with Ruby < 2.6 due to usage of [new `Hash#merge(*others)` with multiple arguments](https://rubyreferences.github.io/rubychanges/2.6.html#hashmerge-with-multiple-arguments) in 0.6.0. [@Envek]
|
36
|
+
|
37
|
+
## 0.6.0 - 2020-07-15
|
38
|
+
|
39
|
+
### Added
|
40
|
+
|
41
|
+
- `Yabeda.with_tags` to redefine default tags for limited amount of time–for all metrics measured during a block execution. [@Envek]
|
42
|
+
|
43
|
+
### Fixed
|
44
|
+
|
45
|
+
- Default tags were not sent to adapters for metrics declared before `default_tag` declaration. [@Envek]
|
46
|
+
|
8
47
|
## 0.5.0 - 2020-01-29
|
9
48
|
|
10
49
|
### Added
|
@@ -45,7 +84,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
45
84
|
|
46
85
|
### Fixed
|
47
86
|
|
48
|
-
- Removed accidental dependency from Rails. @dsalahutdinov
|
87
|
+
- Removed accidental dependency from Rails. [@dsalahutdinov]
|
49
88
|
|
50
89
|
## 0.1.1 - 2018-10-17
|
51
90
|
|
@@ -58,4 +97,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
58
97
|
- Initial release of evil-metrics gem. @Envek
|
59
98
|
|
60
99
|
[@Envek]: https://github.com/Envek "Andrey Novikov"
|
100
|
+
[@dsalahutdinov]: https://github.com/dsalahutdinov "Dmitry Salahutdinov"
|
61
101
|
[@asusikov]: https://github.com/asusikov "Alexander Susikov"
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -49,7 +49,7 @@ And then execute:
|
|
49
49
|
Yabeda.configure!
|
50
50
|
```
|
51
51
|
|
52
|
-
|
52
|
+
_If you're using Ruby on Rails then it will be configured automatically!_
|
53
53
|
|
54
54
|
3. Access metric in your app and use it!
|
55
55
|
|
@@ -84,11 +84,24 @@ And then execute:
|
|
84
84
|
Yabeda.configure do
|
85
85
|
default_tag :rails_environment, 'production'
|
86
86
|
end
|
87
|
+
|
88
|
+
# You can redefine them for limited amount of time
|
89
|
+
Yabeda.with_tags(rails_environment: 'staging') do
|
90
|
+
Yabeda.your_app.bells_rang_count.increment({bell_size: bell.size}, by: 1)
|
91
|
+
end
|
87
92
|
```
|
88
93
|
|
89
94
|
6. See the docs for the adapter you're using
|
90
95
|
7. Enjoy!
|
91
96
|
|
97
|
+
## Available monitoring system adapters
|
98
|
+
|
99
|
+
- [Prometheus](https://github.com/yabeda-rb/yabeda-prometheus)
|
100
|
+
- [Datadog](https://github.com/yabeda-rb/yabeda-datadog)
|
101
|
+
- [NewRelic](https://github.com/yabeda-rb/yabeda-newrelic)
|
102
|
+
- [Statsd](https://github.com/asusikov/yabeda-statsd)
|
103
|
+
- _…and more! You can write your own adapter and open a pull request to add it into this list._
|
104
|
+
|
92
105
|
## Roadmap (aka TODO or Help wanted)
|
93
106
|
|
94
107
|
- Ability to change metric settings for individual adapters
|
data/lib/yabeda.rb
CHANGED
@@ -6,6 +6,7 @@ require "yabeda/version"
|
|
6
6
|
require "yabeda/dsl"
|
7
7
|
require "yabeda/tags"
|
8
8
|
require "yabeda/errors"
|
9
|
+
require "yabeda/railtie" if defined?(Rails)
|
9
10
|
|
10
11
|
# Extendable framework for collecting and exporting metrics from Ruby apps
|
11
12
|
module Yabeda
|
@@ -60,6 +61,7 @@ module Yabeda
|
|
60
61
|
|
61
62
|
# Perform configuration: registration of metrics and collector blocks
|
62
63
|
# @return [void]
|
64
|
+
# rubocop: disable Metrics/MethodLength, Metrics/AbcSize
|
63
65
|
def configure!
|
64
66
|
raise(AlreadyConfiguredError, @configured_by) if already_configured?
|
65
67
|
|
@@ -69,8 +71,17 @@ module Yabeda
|
|
69
71
|
group nil
|
70
72
|
end
|
71
73
|
|
74
|
+
# Register metrics in adapters after evaluating all configuration blocks
|
75
|
+
# to ensure that all global settings (like default tags) will be applied.
|
76
|
+
adapters.each_value do |adapter|
|
77
|
+
metrics.each_value do |metric|
|
78
|
+
adapter.register!(metric)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
72
82
|
@configured_by = caller_locations(1, 1)[0].to_s
|
73
83
|
end
|
84
|
+
# rubocop: enable Metrics/MethodLength, Metrics/AbcSize
|
74
85
|
|
75
86
|
# Forget all the configuration.
|
76
87
|
# For testing purposes as it doesn't rollback changes in adapters.
|
@@ -62,14 +62,30 @@ module Yabeda
|
|
62
62
|
::Yabeda.default_tags[name] = value
|
63
63
|
end
|
64
64
|
|
65
|
+
# Redefine default tags for a limited amount of time
|
66
|
+
# @param tags Hash{Symbol=>#to_s}
|
67
|
+
def with_tags(**tags)
|
68
|
+
Thread.current[:yabeda_temporary_tags] = tags
|
69
|
+
yield
|
70
|
+
ensure
|
71
|
+
Thread.current[:yabeda_temporary_tags] = {}
|
72
|
+
end
|
73
|
+
|
74
|
+
# Get tags set by +with_tags+
|
75
|
+
# @api private
|
76
|
+
# @return Hash
|
77
|
+
def temporary_tags
|
78
|
+
Thread.current[:yabeda_temporary_tags] || {}
|
79
|
+
end
|
80
|
+
|
65
81
|
private
|
66
82
|
|
67
83
|
def register_metric(metric)
|
68
84
|
name = [metric.group, metric.name].compact.join("_")
|
69
85
|
::Yabeda.define_singleton_method(name) { metric }
|
70
86
|
::Yabeda.metrics[name] = metric
|
71
|
-
::Yabeda.adapters.each_value { |adapter| adapter.register!(metric) }
|
72
87
|
register_group_for(metric) if metric.group
|
88
|
+
::Yabeda.adapters.each_value { |adapter| adapter.register!(metric) } if ::Yabeda.configured?
|
73
89
|
metric
|
74
90
|
end
|
75
91
|
|
data/lib/yabeda/gauge.rb
CHANGED
data/lib/yabeda/metric.rb
CHANGED
data/lib/yabeda/tags.rb
CHANGED
data/lib/yabeda/version.rb
CHANGED
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.
|
4
|
+
version: 0.8.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-
|
11
|
+
date: 2020-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- lib/yabeda/group.rb
|
143
143
|
- lib/yabeda/histogram.rb
|
144
144
|
- lib/yabeda/metric.rb
|
145
|
+
- lib/yabeda/railtie.rb
|
145
146
|
- lib/yabeda/tags.rb
|
146
147
|
- lib/yabeda/version.rb
|
147
148
|
- yabeda.gemspec
|
@@ -164,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
165
|
- !ruby/object:Gem::Version
|
165
166
|
version: '0'
|
166
167
|
requirements: []
|
167
|
-
rubygems_version: 3.
|
168
|
+
rubygems_version: 3.1.2
|
168
169
|
signing_key:
|
169
170
|
specification_version: 4
|
170
171
|
summary: Extensible framework for collecting metric for your Ruby application
|