yabeda 0.5.0 → 0.6.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 +10 -0
- data/Gemfile +1 -1
- data/README.md +13 -0
- data/lib/yabeda.rb +10 -0
- data/lib/yabeda/dsl/class_methods.rb +16 -1
- data/lib/yabeda/tags.rb +1 -1
- data/lib/yabeda/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44b181b32e9a07ba7095d67d782e85587fd76280dae1ac5e0feb0a2e5c6ed2c4
|
4
|
+
data.tar.gz: 7c21877d04cc6e5284934619e22e47b75047000c9b1ccb6a936f07d4f5db6fb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4dfbb234b9e84e911ec9c2d5b0477d144eed2c9904d06bed7a1f773646975a1f768277db68732750f2d2d91af509cc5d97b1dbff88f541ab28afb8ee7055c1e
|
7
|
+
data.tar.gz: eecd735270b91d2b8e204edbf547be8f77df5094123590a900c574cb54b2a3fe95eb9295940fab6e097abd396b45417f254269f4a84a9a82ed44b6bc296f0f0f
|
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,16 @@ 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.6.0 - 2020-07-15
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- `Yabeda.with_tags` to redefine default tags for limited amount of time–for all metrics measured during a block execution. [@Envek]
|
13
|
+
|
14
|
+
### Fixed
|
15
|
+
|
16
|
+
- Default tags were not sent to adapters for metrics declared before `default_tag` declaration. [@Envek]
|
17
|
+
|
8
18
|
## 0.5.0 - 2020-01-29
|
9
19
|
|
10
20
|
### Added
|
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,13 +62,28 @@ 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
|
73
88
|
metric
|
74
89
|
end
|
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.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Novikov
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-15 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: []
|
@@ -149,7 +149,7 @@ homepage: https://github.com/yabeda-rb/yabeda
|
|
149
149
|
licenses:
|
150
150
|
- MIT
|
151
151
|
metadata: {}
|
152
|
-
post_install_message:
|
152
|
+
post_install_message:
|
153
153
|
rdoc_options: []
|
154
154
|
require_paths:
|
155
155
|
- lib
|
@@ -164,8 +164,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
164
|
- !ruby/object:Gem::Version
|
165
165
|
version: '0'
|
166
166
|
requirements: []
|
167
|
-
rubygems_version: 3.
|
168
|
-
signing_key:
|
167
|
+
rubygems_version: 3.1.2
|
168
|
+
signing_key:
|
169
169
|
specification_version: 4
|
170
170
|
summary: Extensible framework for collecting metric for your Ruby application
|
171
171
|
test_files: []
|