emrb 0.1.0 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67a0d802b62cf9845b629d83b043030c9140e9c8d931c7937aaa03ad3dec1f27
4
- data.tar.gz: 425652e89206e2e1b5ad1e714b49ce7928302cb87616d1def2c8bc6b642a1c80
3
+ metadata.gz: f15f9f402475d30026e70a8cce75b215795571fce2f9dcd4136bf1dba606531c
4
+ data.tar.gz: e067cdaeed6f55961b1575092eb568bda41ac599b076ae43f2e4d6dee6573ba6
5
5
  SHA512:
6
- metadata.gz: 42efa7169bf01425067f988fb20c0c54c9a1c87a149dca417b3f14f2d0fc4b6a7d5bed286ee16b51ac0745009f5cfbc9712d0c441a2b56ea09924279af0325ff
7
- data.tar.gz: 6fc41dfa38ab82be8d310d7fd04ac4c8530f2a3c3c8a7ad9d3766795df7b1ac0f13ef272b6a2e452a4eba8773094405a6a834308d06f9a21fa47bb4626df54c7
6
+ metadata.gz: 7c1b89985d30211a1d78c1243ad8ca36cd20147230c93ee19140e2ad79dbff05655c1ca973f56936544ca9f446bb550e1036acebfdf12457831de7783ca2fe8d
7
+ data.tar.gz: bb6f9946b27080c769f5a9d258e5385548d1a043aed15c1b4d1f97cf1bef95d271a75b9c95c5056a8196743ff3f9f9b7dee7e57f95de2f49db2cd81770b021a7
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- emrb (0.1.0)
4
+ emrb (0.1.2)
5
5
  prometheus-client (~> 4)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- emrb (0.1.0)
4
+ emrb (0.1.2)
5
5
  prometheus-client (~> 4)
6
6
 
7
7
  GEM
@@ -19,6 +19,15 @@ module Prometheus
19
19
  # that can be used for implementing facilities.
20
20
  class Histogram
21
21
  alias obs observe
22
+
23
+ def measure(**, &)
24
+ raise LocalJumpError, "no block given" unless block_given?
25
+
26
+ now = Time.now
27
+ yield
28
+ ensure
29
+ obs(Time.now - now, **)
30
+ end
22
31
  end
23
32
 
24
33
  # Internal: Extension of Prometheus::Client::Summary
@@ -70,7 +70,7 @@ module Emrb
70
70
  # For a full list of options and functionalities for creating and utilizing a Gauge,
71
71
  # refer to the Prometheus client documentation:
72
72
  # https://github.com/prometheus/client_ruby?tab=readme-ov-file#gauge
73
- def gauge(identifier, docs, **, &)
73
+ def gauge(identifier, docs = "...", **, &)
74
74
  check_identifier!(identifier)
75
75
  opts = block_opts(**, &)
76
76
  State.gauge(id_for(identifier), docs, **opts).tap do |g|
@@ -108,7 +108,7 @@ module Emrb
108
108
  # For all available options and functionalities for creating and utilizing a Histogram,
109
109
  # refer to the Prometheus client documentation:
110
110
  # https://github.com/prometheus/client_ruby?tab=readme-ov-file#histogram
111
- def histogram(identifier, docs, **, &)
111
+ def histogram(identifier, docs = "...", **, &)
112
112
  check_identifier!(identifier)
113
113
  opts = block_opts(**, &)
114
114
  State.histogram(id_for(identifier), docs, **opts).tap do |h|
@@ -139,7 +139,7 @@ module Emrb
139
139
  # For a complete list of options and functionalities for creating and utilizing a Summary,
140
140
  # refer to the Prometheus client documentation:
141
141
  # https://github.com/prometheus/client_ruby?tab=readme-ov-file#summary
142
- def summary(identifier, docs, **, &)
142
+ def summary(identifier, docs = "...", **, &)
143
143
  check_identifier!(identifier)
144
144
  opts = block_opts(**, &)
145
145
  State.summary(id_for(identifier), docs, **opts).tap do |s|
data/lib/emrb/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Emrb
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felipe Mariotti