vitals 0.10.1 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/vitals.rb +1 -0
- data/lib/vitals/formats/no_host_format.rb +24 -0
- data/lib/vitals/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6cf157b39339d035a8a2100360fe59a4a4fe620
|
4
|
+
data.tar.gz: 37f1676444c8d38a9c3979fe21f8ca0ea4f6ff4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e678c0ee07b39216d35ec15124402c57200d10061f8ec5bf989298aa6402996922321fa4e9d51e9d4558b46e8773560894e5aaae1dfb773c34e1894b060752fa
|
7
|
+
data.tar.gz: 9a22802c6f34bea3c9cab36217de6baa763e158058f02cdb3526adc6561ec8f443188ab3ef23a032da49998053ee6e662cfaf9236d193ebd55d8c29a93c99456
|
data/Gemfile.lock
CHANGED
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
|
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 `
|
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
@@ -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
|
data/lib/vitals/version.rb
CHANGED
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.
|
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-
|
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
|