vitals 0.8.0 → 0.8.1
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 +33 -0
- data/lib/vitals.rb +2 -2
- data/lib/vitals/configuration.rb +11 -0
- data/lib/vitals/utils.rb +9 -2
- data/lib/vitals/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca96cc1adb1b7c17cdb2acca6f7310620c514569
|
4
|
+
data.tar.gz: 010ec1d5084df975ab6725a7a283a83efeebee28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c2d1718b765b1359cb49a4325c4047fb6253ce5e2525615c5447c2561ef8321fefa886d6ad25c5f95f37254f1105f19ea36ad7231fa5fb613140849b87d34e8
|
7
|
+
data.tar.gz: 5a3c71d712e5f8a639e5354c72eb1255f7f6884f39ccc6ef55f625daf7099e5124bbff493ecd0bfb514aabba8ed05778435471f6b14f8d9430aa6fec7eaf0ff3
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -140,9 +140,42 @@ Vitals.configure! do |c|
|
|
140
140
|
|
141
141
|
# Use a different format perhaps? (default: ProductionFormat)
|
142
142
|
# c.format = Vitals::Formats::HostLastFormat
|
143
|
+
|
144
|
+
# Use a different metric path separator, control how hierarcies are generated (default: '.')
|
145
|
+
# c.path_sep = '__'
|
143
146
|
end
|
144
147
|
```
|
145
148
|
|
149
|
+
### Metric Hierarchies
|
150
|
+
|
151
|
+
If you leave the default metric path separator, it will be a dot. This means Graphite will parse
|
152
|
+
this and generate a branch in the tree when ever it sees a new segment, so:
|
153
|
+
|
154
|
+
```
|
155
|
+
requests.api.status.registration.get.200.host-123
|
156
|
+
```
|
157
|
+
|
158
|
+
Will be created from a `GET /api/status/registration`
|
159
|
+
|
160
|
+
On the other hand, if you choose a non-dot separator, like underscore, then:
|
161
|
+
|
162
|
+
```
|
163
|
+
requests.api_status_registration.get.200.host-123
|
164
|
+
```
|
165
|
+
|
166
|
+
Will be generated from a `GET /api/status/registration`.
|
167
|
+
|
168
|
+
You can pick either of those and the trade-offs are:
|
169
|
+
|
170
|
+
* Nested hierarchy (using a dot): fine-grained control over grouping your metrics efficiently. If you
|
171
|
+
want to pick and choose a metric, and be able to group based on topics efficiently. You cannot group cross-segments of a path in graphite.
|
172
|
+
|
173
|
+
* Flat hierarchy (using anything other than a dot, like an underscore): grouping over segments can be glob-like, so
|
174
|
+
quick wins like "graph all errors" can be had like this: `api.*.500.*`. However, every time you want to group metrics, you will need to find
|
175
|
+
the appropriate glob pattern, which will taxi Graphite for a huge amounts of metrics.
|
176
|
+
|
177
|
+
The default separator is a dot, which makes everything hierarchical.
|
178
|
+
|
146
179
|
|
147
180
|
|
148
181
|
## Development
|
data/lib/vitals.rb
CHANGED
@@ -45,12 +45,12 @@ module Vitals
|
|
45
45
|
klass.subscribe!
|
46
46
|
end
|
47
47
|
end
|
48
|
+
|
48
49
|
#
|
49
50
|
# reporter delegators
|
50
51
|
#
|
51
52
|
# hardwired for performance
|
52
|
-
#
|
53
|
-
# TODO timing
|
53
|
+
# (forwardable delegators go through __send__ and generate gc waste)
|
54
54
|
def self.inc(m)
|
55
55
|
reporter.inc(m)
|
56
56
|
end
|
data/lib/vitals/configuration.rb
CHANGED
@@ -12,6 +12,17 @@ module Vitals
|
|
12
12
|
@host = fetch_host
|
13
13
|
@reporter = Vitals::Reporters::InmemReporter.new
|
14
14
|
@format = Vitals::Formats::ProductionFormat
|
15
|
+
self.path_sep = '.'
|
16
|
+
end
|
17
|
+
|
18
|
+
# delegate to utils, until this part of the utils
|
19
|
+
# finds a new home with a new abstraction
|
20
|
+
def path_sep=(val)
|
21
|
+
Vitals::Utils.path_sep = val
|
22
|
+
end
|
23
|
+
|
24
|
+
def path_sep
|
25
|
+
Vitals::Utils.path_sep = val
|
15
26
|
end
|
16
27
|
|
17
28
|
def build_format
|
data/lib/vitals/utils.rb
CHANGED
@@ -17,9 +17,16 @@ module Vitals
|
|
17
17
|
path = route.route_path.dup[1..-1] # /foo/bar/baz -> foo/bar/baz
|
18
18
|
path.sub!(/\(\..*\)$/, '') # (.json) -> ''
|
19
19
|
path.sub!(":version", version) if version # :version -> v1
|
20
|
-
path.gsub!(/\//,
|
21
|
-
path.gsub!(/\//, ".")
|
20
|
+
path.gsub!(/\//, self.path_sep) # foo/bar -> foo.bar
|
22
21
|
path
|
23
22
|
end
|
23
|
+
|
24
|
+
def self.path_sep
|
25
|
+
@path_sep
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.path_sep=(val)
|
29
|
+
@path_sep = val
|
30
|
+
end
|
24
31
|
end
|
25
32
|
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.8.
|
4
|
+
version: 0.8.1
|
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-
|
11
|
+
date: 2016-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: statsd-ruby
|