vitals 0.10.1 → 0.11.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: fc9945394e2857e3979c40aeffa43eded090be43
4
- data.tar.gz: bbfd7cf6c3fa9a8f11ed28e0d05a51dbb24df76a
3
+ metadata.gz: a6cf157b39339d035a8a2100360fe59a4a4fe620
4
+ data.tar.gz: 37f1676444c8d38a9c3979fe21f8ca0ea4f6ff4e
5
5
  SHA512:
6
- metadata.gz: bb34348b92066800ffda67edd882e08dc257823df325f757ea28dfcd614a8ad58854e5f8433b87d2014e7fb917586d3661add2c792ae7d24dfced4227510a1b5
7
- data.tar.gz: 97632c34846797d5a7a0b08a4874a06ee4f210b7f306f4b6153eec3e41d43e6851ae3b20d86da38a1a82ab39c82058b1e64d42173c69212cc17ba92518c98fb1
6
+ metadata.gz: e678c0ee07b39216d35ec15124402c57200d10061f8ec5bf989298aa6402996922321fa4e9d51e9d4558b46e8773560894e5aaae1dfb773c34e1894b060752fa
7
+ data.tar.gz: 9a22802c6f34bea3c9cab36217de6baa763e158058f02cdb3526adc6561ec8f443188ab3ef23a032da49998053ee6e662cfaf9236d193ebd55d8c29a93c99456
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vitals (0.10.1)
4
+ vitals (0.11.0)
5
5
  statsd-ruby (~> 1.3.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -28,7 +28,7 @@ Or install it yourself as:
28
28
 
29
29
  ### Rails or Grape
30
30
 
31
- Make an `initializers/vitals.rb` initializer, and cofigure Vitals as you'd like:
31
+ Make an `initializers/vitals.rb` initializer, and configure Vitals as you'd like:
32
32
  ```ruby
33
33
  require 'vitals'
34
34
  Vitals.configure! do |c|
@@ -121,7 +121,7 @@ and it revolves around 3 concepts:
121
121
  and `ConsoleReporter` in development. `ConsoleReporter` will spit out metrics to `stdout` as they come. You can also
122
122
  wire them _both_ with `MultiReporter`. Check the [specs](/spec/reporters) for how to do that.
123
123
  2. `Format` - takes the contextual information (host, service, environment) and your metric, and formats them in an
124
- order that makes sense for working with Graphite. You have the `ProductionFormat` and `HostLastFormat`.
124
+ order that makes sense for working with Graphite. You have the `ProductionFormat`, `HostLastFormat` and `NoHostFormat`.
125
125
  3. `Integrations` - integrations hook things that we're able to instrument with Vitals. Check [integrations](/lib/vitals/integrations) for more.
126
126
 
127
127
  Here's what's available to you at configuration time:
data/lib/vitals.rb CHANGED
@@ -19,6 +19,7 @@ require 'vitals/reporters/dns_resolving_statsd_reporter'
19
19
 
20
20
  require 'vitals/formats/production_format'
21
21
  require 'vitals/formats/host_last_format'
22
+ require 'vitals/formats/no_host_format'
22
23
 
23
24
 
24
25
  module Vitals
@@ -0,0 +1,24 @@
1
+ module Vitals::Formats
2
+ class NoHostFormat
3
+ attr_accessor :environment
4
+ attr_accessor :facility
5
+
6
+ def initialize(environment:'development', facility:'default', host: nil)
7
+ @environment = environment
8
+ @facility = facility
9
+ @host = host
10
+ @prefix = [environment, facility].compact
11
+ .map { |m| Vitals::Utils.normalize_metric(m) }
12
+ .join(Vitals::Utils::SEPARATOR)
13
+ .freeze
14
+ end
15
+
16
+ def format(m)
17
+ return @prefix if (m.nil? || m.empty?)
18
+ # TODO optimize by building a renderer function (inlining this) in the initializer.
19
+ # see https://github.com/evanphx/benchmark-ips/blob/master/lib/benchmark/ips/job/entry.rb#L63
20
+ [@prefix, Vitals::Utils.normalize_metric(m)].reject{|s| s.nil? || s.empty? }
21
+ .join(Vitals::Utils::SEPARATOR)
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module Vitals
2
- VERSION = "0.10.1"
2
+ VERSION = "0.11.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vitals
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dotan Nahum
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-14 00:00:00.000000000 Z
11
+ date: 2016-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: statsd-ruby
@@ -226,6 +226,7 @@ files:
226
226
  - lib/vitals.rb
227
227
  - lib/vitals/configuration.rb
228
228
  - lib/vitals/formats/host_last_format.rb
229
+ - lib/vitals/formats/no_host_format.rb
229
230
  - lib/vitals/formats/production_format.rb
230
231
  - lib/vitals/integrations/notifications/action_controller.rb
231
232
  - lib/vitals/integrations/notifications/active_job.rb