yabeda 0.4.0 → 0.7.0
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/.rubocop.yml +9 -4
- data/.travis.yml +0 -1
- data/CHANGELOG.md +43 -1
- data/Gemfile +1 -1
- data/README.md +13 -0
- data/lib/yabeda.rb +10 -0
- data/lib/yabeda/dsl/class_methods.rb +17 -1
- data/lib/yabeda/gauge.rb +8 -0
- data/lib/yabeda/metric.rb +2 -1
- data/lib/yabeda/tags.rb +1 -1
- data/lib/yabeda/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e30282089c3784919bbdfef129e36f9898bbe30376dec4148ab45551835e95a
|
4
|
+
data.tar.gz: 9abb1750e05b17f4f97f5d3c91d9eaf6f638c735b82d46baa1618500edf373da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8fb61bea63f36d9f8ea98985c12d5247cefe7463ad2129f3bbda1ffbff34cc8faa4b71d797f44e02cc957a2159cdca3b53996fbf641e496476ab04e47489f3d
|
7
|
+
data.tar.gz: 66f06b7e63832eda3d43e0266fc4aa38726b261215a5308930bc9757a344dd60f43844a3d9b5f74a62069e1c090664248505d8a2408f0d6801685ccd926ea8b4
|
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,47 @@ 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.7.0 - 2020-08-07
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- `#increment` and `#decrement` convenience methods for `Yabeda::Gauge`. [#13](https://github.com/yabeda-rb/yabeda/pull/13) by [@dsalahutdinov]
|
13
|
+
- Ability to use custom step in `#increment` and `#decrement` for gauges. [@Envek]
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
|
17
|
+
- Account for default tags in `Yabeda::Metric#get`. [@Envek]
|
18
|
+
|
19
|
+
## 0.6.2 - 2020-08-04
|
20
|
+
|
21
|
+
### Fixed
|
22
|
+
|
23
|
+
- 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]
|
24
|
+
|
25
|
+
## 0.6.1 - 2020-07-16
|
26
|
+
|
27
|
+
### Fixed
|
28
|
+
|
29
|
+
- 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]
|
30
|
+
|
31
|
+
## 0.6.0 - 2020-07-15
|
32
|
+
|
33
|
+
### Added
|
34
|
+
|
35
|
+
- `Yabeda.with_tags` to redefine default tags for limited amount of time–for all metrics measured during a block execution. [@Envek]
|
36
|
+
|
37
|
+
### Fixed
|
38
|
+
|
39
|
+
- Default tags were not sent to adapters for metrics declared before `default_tag` declaration. [@Envek]
|
40
|
+
|
41
|
+
## 0.5.0 - 2020-01-29
|
42
|
+
|
43
|
+
### Added
|
44
|
+
|
45
|
+
- Ability to specify aggregation policy for metrics collected from multiple process and exposed via single endpoint. [@Envek]
|
46
|
+
|
47
|
+
For now it is only used by yabeda-prometheus when official Prometheus client is configured to use file storage for metrics.
|
48
|
+
|
8
49
|
## 0.4.0 - 2020-01-28
|
9
50
|
|
10
51
|
### Changed
|
@@ -37,7 +78,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
37
78
|
|
38
79
|
### Fixed
|
39
80
|
|
40
|
-
- Removed accidental dependency from Rails. @dsalahutdinov
|
81
|
+
- Removed accidental dependency from Rails. [@dsalahutdinov]
|
41
82
|
|
42
83
|
## 0.1.1 - 2018-10-17
|
43
84
|
|
@@ -50,4 +91,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
50
91
|
- Initial release of evil-metrics gem. @Envek
|
51
92
|
|
52
93
|
[@Envek]: https://github.com/Envek "Andrey Novikov"
|
94
|
+
[@dsalahutdinov]: https://github.com/dsalahutdinov "Dmitry Salahutdinov"
|
53
95
|
[@asusikov]: https://github.com/asusikov "Alexander Susikov"
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -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
@@ -60,6 +60,7 @@ module Yabeda
|
|
60
60
|
|
61
61
|
# Perform configuration: registration of metrics and collector blocks
|
62
62
|
# @return [void]
|
63
|
+
# rubocop: disable Metrics/MethodLength, Metrics/AbcSize
|
63
64
|
def configure!
|
64
65
|
raise(AlreadyConfiguredError, @configured_by) if already_configured?
|
65
66
|
|
@@ -69,8 +70,17 @@ module Yabeda
|
|
69
70
|
group nil
|
70
71
|
end
|
71
72
|
|
73
|
+
# Register metrics in adapters after evaluating all configuration blocks
|
74
|
+
# to ensure that all global settings (like default tags) will be applied.
|
75
|
+
adapters.each_value do |adapter|
|
76
|
+
metrics.each_value do |metric|
|
77
|
+
adapter.register!(metric)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
72
81
|
@configured_by = caller_locations(1, 1)[0].to_s
|
73
82
|
end
|
83
|
+
# rubocop: enable Metrics/MethodLength, Metrics/AbcSize
|
74
84
|
|
75
85
|
# Forget all the configuration.
|
76
86
|
# 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
@@ -13,10 +13,11 @@ module Yabeda
|
|
13
13
|
option :unit, optional: true, comment: "In which units it is measured. E.g. `seconds`"
|
14
14
|
option :per, optional: true, comment: "Per which unit is measured `unit`. E.g. `call` as in seconds per call"
|
15
15
|
option :group, optional: true, comment: "Category name for grouping metrics"
|
16
|
+
option :aggregation, optional: true, comment: "How adapters should aggregate values from different processes"
|
16
17
|
|
17
18
|
# Returns the value for the given label set
|
18
19
|
def get(labels = {})
|
19
|
-
values[labels]
|
20
|
+
values[::Yabeda::Tags.build(labels)]
|
20
21
|
end
|
21
22
|
|
22
23
|
def values
|
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.7.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-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -111,7 +111,7 @@ 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: []
|
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
164
|
- !ruby/object:Gem::Version
|
165
165
|
version: '0'
|
166
166
|
requirements: []
|
167
|
-
rubygems_version: 3.
|
167
|
+
rubygems_version: 3.1.2
|
168
168
|
signing_key:
|
169
169
|
specification_version: 4
|
170
170
|
summary: Extensible framework for collecting metric for your Ruby application
|