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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22251cae8ed5dfe457f58b95ab4ff44342551cb8
4
- data.tar.gz: 81ba009c776476e8a2e92261e7d51b49a9ad6b27
3
+ metadata.gz: ca96cc1adb1b7c17cdb2acca6f7310620c514569
4
+ data.tar.gz: 010ec1d5084df975ab6725a7a283a83efeebee28
5
5
  SHA512:
6
- metadata.gz: a6833d733be34fa74b38faa5b7eee2d49af619e1b41bd2119a4de160d5cf0f974f4144ff84298d8627fdece985f6e5400449da3043d64eb60610767a414be177
7
- data.tar.gz: ecdabc5249ec20afef0bc8507f734cf255060a2dd21bc79e3922e7e5f86722ae2a3661074cb75f65332ff568a285daf72b4c3b8a1d565e46c19bf7dfc1957041
6
+ metadata.gz: 0c2d1718b765b1359cb49a4325c4047fb6253ce5e2525615c5447c2561ef8321fefa886d6ad25c5f95f37254f1105f19ea36ad7231fa5fb613140849b87d34e8
7
+ data.tar.gz: 5a3c71d712e5f8a639e5354c72eb1255f7f6884f39ccc6ef55f625daf7099e5124bbff493ecd0bfb514aabba8ed05778435471f6b14f8d9430aa6fec7eaf0ff3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vitals (0.7.0)
4
+ vitals (0.8.0)
5
5
  statsd-ruby (~> 1.3.0)
6
6
 
7
7
  GEM
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
@@ -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!(/\//, ".") # foo/bar -> foo.bar
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
@@ -1,3 +1,3 @@
1
1
  module Vitals
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
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.8.0
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-04-05 00:00:00.000000000 Z
11
+ date: 2016-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: statsd-ruby