yabeda 0.13.0 → 0.13.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/test.yml +4 -0
- data/CHANGELOG.md +13 -0
- data/README.md +1 -1
- data/lib/yabeda/counter.rb +26 -1
- data/lib/yabeda/gauge.rb +12 -2
- data/lib/yabeda/rspec/base_matcher.rb +1 -1
- data/lib/yabeda/rspec/increment_yabeda_counter.rb +1 -1
- data/lib/yabeda/rspec/measure_yabeda_histogram.rb +1 -0
- data/lib/yabeda/rspec/observe_yabeda_summary.rb +1 -0
- data/lib/yabeda/rspec/update_yabeda_gauge.rb +1 -0
- data/lib/yabeda/version.rb +1 -1
- data/lib/yabeda.rb +2 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c713eeb29eb6f5eb9a022b2bb43f85961a72dca331629ca0ab335b2c72e9bd4d
|
4
|
+
data.tar.gz: e9309522c7b6e8982518d8a03d52e6b3096c61647cdb63a618e957da5b6f50d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cb7676c26c849772cd27ddb180e5d733af2243b890d9dbb83dc7ff73ca57ed861a651ee7fa22f36410800600976ee0920115b96f36d036ed65b5652b6ff4dce
|
7
|
+
data.tar.gz: 0a145163ed0af2f669b8eaa235784b1bbbb0011a2222d4c5a44adca6461d264024a075c7c48a54fbdab089d8e8d2f41a3e96f9009fdb272b46ca2ba35d567c0c
|
data/.github/workflows/test.yml
CHANGED
@@ -14,10 +14,14 @@ jobs:
|
|
14
14
|
# Skip running tests for local pull requests (use push event instead), run only for foreign ones
|
15
15
|
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login != github.event.pull_request.base.repo.owner.login
|
16
16
|
runs-on: ubuntu-latest
|
17
|
+
continue-on-error: ${{ matrix.optional || false }}
|
17
18
|
strategy:
|
18
19
|
fail-fast: false
|
19
20
|
matrix:
|
20
21
|
include:
|
22
|
+
- ruby: head
|
23
|
+
optional: true
|
24
|
+
- ruby: "3.4"
|
21
25
|
- ruby: "3.3"
|
22
26
|
- ruby: "3.2"
|
23
27
|
- ruby: "3.1"
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
7
7
|
|
8
8
|
## Unreleased
|
9
9
|
|
10
|
+
## 0.13.2 - 2025-09-09
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
|
14
|
+
- Fix false positives of rspec matchers [@jbockler][] in [#42](https://github.com/yabeda-rb/yabeda/pull/42)
|
15
|
+
|
16
|
+
## 0.13.1 - 2024-10-11
|
17
|
+
|
18
|
+
### Fixed
|
19
|
+
|
20
|
+
- Compatibility with Ruby 2.x, broken in 0.13.0 due to differences of keywords handling in Ruby 2.x for case when method has arguments with default values. [@Envek]
|
21
|
+
|
10
22
|
## 0.13.0 - 2024-10-02
|
11
23
|
|
12
24
|
### Added
|
@@ -183,3 +195,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
183
195
|
[@liaden]: https://github.com/liaden "Joel Johnson"
|
184
196
|
[@bibendi]: https://github.com/bibendi "Misha Merkushin"
|
185
197
|
[@Keallar]: https://github.com/Keallar "Eugene Lysanskiy"
|
198
|
+
[@jbockler]: https://github.com/jbockler "Josch Bockler"
|
data/README.md
CHANGED
@@ -120,7 +120,7 @@ And then execute:
|
|
120
120
|
|
121
121
|
- Prometheus:
|
122
122
|
- [yabeda-prometheus](https://github.com/yabeda-rb/yabeda-prometheus) — wraps [official Ruby client for Prometheus](https://github.com/prometheus/client_ruby).
|
123
|
-
- [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.
|
123
|
+
- [yabeda-prometheus-mmap](https://github.com/yabeda-rb/yabeda-prometheus-mmap) — wraps [GitLab's fork of Prometheus Ruby client](https://gitlab.com/gitlab-org/ruby/gems/prometheus-client-mmap) which may work better for multi-process application servers.
|
124
124
|
- [Datadog](https://github.com/yabeda-rb/yabeda-datadog)
|
125
125
|
- [NewRelic](https://github.com/yabeda-rb/yabeda-newrelic)
|
126
126
|
|
data/lib/yabeda/counter.rb
CHANGED
@@ -3,7 +3,12 @@
|
|
3
3
|
module Yabeda
|
4
4
|
# Growing-only counter
|
5
5
|
class Counter < Metric
|
6
|
-
|
6
|
+
# @overload increment(tags = {}, by: 1)
|
7
|
+
# Increment the counter for given set of tags by the given increment value
|
8
|
+
# @param tags Hash{Symbol=>#to_s} tags to identify the counter
|
9
|
+
# @param by [Integer] strictly positive increment value
|
10
|
+
def increment(*args)
|
11
|
+
tags, by = self.class.parse_args(*args)
|
7
12
|
all_tags = ::Yabeda::Tags.build(tags, group)
|
8
13
|
values[all_tags] += by
|
9
14
|
adapters.each_value do |adapter|
|
@@ -15,5 +20,25 @@ module Yabeda
|
|
15
20
|
def values
|
16
21
|
@values ||= Concurrent::Hash.new(0)
|
17
22
|
end
|
23
|
+
|
24
|
+
# @api private
|
25
|
+
# rubocop:disable Metrics/MethodLength
|
26
|
+
def self.parse_args(*args)
|
27
|
+
case args.size
|
28
|
+
when 0 # increment()
|
29
|
+
[EMPTY_TAGS, 1]
|
30
|
+
when 1 # increment(by: 5) or increment(tags)
|
31
|
+
if args[0].key?(:by)
|
32
|
+
[EMPTY_TAGS, args.fetch(:by)]
|
33
|
+
else
|
34
|
+
[args[0], 1]
|
35
|
+
end
|
36
|
+
when 2 # increment(tags, by: 5)
|
37
|
+
[args[0], args[1].fetch(:by, 1)]
|
38
|
+
else
|
39
|
+
raise ArgumentError, "wrong number of arguments (given #{args.size}, expected 0..2)"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
# rubocop:enable Metrics/MethodLength
|
18
43
|
end
|
19
44
|
end
|
data/lib/yabeda/gauge.rb
CHANGED
@@ -12,11 +12,21 @@ module Yabeda
|
|
12
12
|
value
|
13
13
|
end
|
14
14
|
|
15
|
-
|
15
|
+
# @overload increment(tags = {}, by: 1)
|
16
|
+
# Convenience method to increment current gauge value for given set of tags by the given increment value
|
17
|
+
# @param tags Hash{Symbol=>#to_s} tags to identify the gauge
|
18
|
+
# @param by [Integer] increment value
|
19
|
+
def increment(*args)
|
20
|
+
tags, by = Counter.parse_args(*args)
|
16
21
|
set(tags, get(tags).to_i + by)
|
17
22
|
end
|
18
23
|
|
19
|
-
|
24
|
+
# @overload decrement(tags = {}, by: 1)
|
25
|
+
# Convenience method to decrement current gauge value for given set of tags by the given decrement value
|
26
|
+
# @param tags Hash{Symbol=>#to_s} tags to identify the gauge
|
27
|
+
# @param by [Integer] decrement value
|
28
|
+
def decrement(*args)
|
29
|
+
tags, by = Counter.parse_args(*args)
|
20
30
|
set(tags, get(tags).to_i - by)
|
21
31
|
end
|
22
32
|
end
|
@@ -36,7 +36,7 @@ module Yabeda
|
|
36
36
|
end
|
37
37
|
|
38
38
|
# RSpec doesn't define this method, but it is more convenient to rely on +match_when_negated+ method presence
|
39
|
-
def does_not_match?(actual)
|
39
|
+
def does_not_match?(actual) # rubocop:disable Naming/PredicatePrefix
|
40
40
|
@actual = actual
|
41
41
|
if respond_to?(:match_when_negated)
|
42
42
|
match_when_negated(expected, actual)
|
data/lib/yabeda/version.rb
CHANGED
data/lib/yabeda.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.13.
|
4
|
+
version: 0.13.2
|
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:
|
11
|
+
date: 2025-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: anyway_config
|
@@ -114,7 +114,7 @@ homepage: https://github.com/yabeda-rb/yabeda
|
|
114
114
|
licenses:
|
115
115
|
- MIT
|
116
116
|
metadata: {}
|
117
|
-
post_install_message:
|
117
|
+
post_install_message:
|
118
118
|
rdoc_options: []
|
119
119
|
require_paths:
|
120
120
|
- lib
|
@@ -129,8 +129,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
131
|
requirements: []
|
132
|
-
rubygems_version: 3.5.
|
133
|
-
signing_key:
|
132
|
+
rubygems_version: 3.5.22
|
133
|
+
signing_key:
|
134
134
|
specification_version: 4
|
135
135
|
summary: Extensible framework for collecting metric for your Ruby application
|
136
136
|
test_files: []
|