prometheus_reporter 1.0.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df4a4042a47ad2b5b0308c03754b85e747a40c21
4
- data.tar.gz: '088e89c9d7735eebfa3ffd6a0b41017fcc292937'
3
+ metadata.gz: c11682f278ffa6194feba297168ed641d4824b1c
4
+ data.tar.gz: cdfeba4d64550cb025823205cd97e43b6cea3047
5
5
  SHA512:
6
- metadata.gz: 4e4a88947ef124cfacd3639dd72747075a612eeb68d33e03d34d754ab4bc44ffa2663ed3a057e775bf10a2cf6ba63b98fa37d553f50467284d4d073532478390
7
- data.tar.gz: 1de01a6cb0e01149796bb821ab149cf58b7861b7420abd023ac4959520b494cb2ffbc7a7e2c0a530899b24825da8b6c2a212f2d02978a079feb634daba217a07
6
+ metadata.gz: 8f43647a52cb5db960921c3fe8d821760a739d9513a0d53ee8fcaa856555d6555eca907ea407f9fbb5ee253734f665f70346d9c8df59ea1e5a5149b8e0d04d01
7
+ data.tar.gz: 2fc302c361a09b9af7fc1ccc82c1aad3f7c75faadd21b0eda5fe1c393fa4934b2a7fe5fd75e5b9cd39f3a7d22d1b74e4653a145b1ca09254f04d78be056f34b0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.1.0 (2018-01-15)
2
+ Added TextFormatter.draw method with DSL
3
+
1
4
  ## 1.0.0 (2018-01-11)
2
5
 
3
6
  The very first version released.
data/README.md CHANGED
@@ -80,6 +80,24 @@ facebook_clone_emails_today{type="notify_for_inactivity"} 10 1515681885
80
80
  facebook_clone_emails_today{type="registration_confirmation"} 18 1515681886
81
81
  ```
82
82
 
83
+ ### DSL
84
+
85
+ You can also use DSL to define reports:
86
+
87
+ ```ruby
88
+ report =
89
+ PrometheusReporter::TextFormatter.draw(prefix: 'my_application') do
90
+ type :emails_today, :counter
91
+ entry :emails_today, value: 1337
92
+
93
+ type :registrations_today, :counter
94
+ entry :registrations_today, value: 105
95
+
96
+ type :payments_total, :summary
97
+ entry :payments_total, 29913
98
+ end
99
+ ```
100
+
83
101
  ## Usefull links
84
102
  - Official Prometheus [ruby client](https://github.com/prometheus/client_ruby)
85
103
  - [Prometheus](https://github.com/prometheus) itself
@@ -10,6 +10,14 @@ module PrometheusReporter
10
10
  TOKENS = [HELP_TOKEN, TYPE_TOKEN].freeze
11
11
  SEPARATOR = "\n"
12
12
 
13
+ class << self
14
+ def draw(prefix: PrometheusReporter.config.prefix, &block)
15
+ formatter = new(prefix: prefix)
16
+ formatter.instance_eval(&block)
17
+ formatter.to_s
18
+ end
19
+ end
20
+
13
21
  def initialize(prefix: PrometheusReporter.config.prefix)
14
22
  @data = {}
15
23
  @prefix = prefix
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PrometheusReporter
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prometheus_reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleksii Kuznietsov (nattfodd)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-12 00:00:00.000000000 Z
11
+ date: 2018-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry