strumbar 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # CHANGELOG
2
+
3
+ ## 0.3.0 (2013-02-04)
4
+
5
+ * Adds wrapper for gauge, set, and count: `Strumbar::Client.(gauge|set|count) key, value, sample_rate = Strumbar.default_rate`.
6
+ * Fixes bug with `Strumbar::Client.decrement` adding extraneous '#' to application prefix
7
+
8
+ ## 0.2.0 (2013-02-04)
9
+
10
+ * Added Mongoid instrument to Strumbar, with controller runtime logging functionality (replaces AR-style db_time reporting if loaded).
@@ -12,11 +12,23 @@ module Strumbar
12
12
  end
13
13
 
14
14
  def increment stat, sample_rate = Strumbar.default_rate
15
- super "#{Strumbar.application}.#{stat}", sample_rate
15
+ super stat, sample_rate
16
16
  end
17
17
 
18
18
  def decrement stat, sample_rate = Strumbar.default_rate
19
- super "##{Strumbar.application}.#{stat}", sample_rate
19
+ super stat, sample_rate
20
+ end
21
+
22
+ def count stat, value, sample_rate = Strumbar.default_rate
23
+ super "#{Strumbar.application}.#{stat}", value, sample_rate
24
+ end
25
+
26
+ def gauge stat, value, sample_rate = Strumbar.default_rate
27
+ super "#{Strumbar.application}.#{stat}", value, sample_rate
28
+ end
29
+
30
+ def set stat, value, sample_rate = Strumbar.default_rate
31
+ super "#{Strumbar.application}.#{stat}", value, sample_rate
20
32
  end
21
33
  end
22
34
  end
@@ -1,3 +1,3 @@
1
1
  module Strumbar
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+ module Strumbar
4
+ describe Client do
5
+ let(:client) {
6
+ Client.new('test', 1234)
7
+ }
8
+
9
+ STATSD_CODES = {
10
+ 'increment' => :c,
11
+ 'decrement' => :c,
12
+ 'count' => :c,
13
+ 'timing' => :ms,
14
+ 'gauge' => :g,
15
+ 'set' => :s
16
+ }
17
+
18
+ STATSD_CODES.each do |method, code|
19
+ describe "##{method}" do
20
+ it "proxies to #send_stats with a namespaced key and the right code" do
21
+ value = case method
22
+ when 'increment'
23
+ 1
24
+ when 'decrement'
25
+ -1
26
+ else
27
+ 100
28
+ end
29
+
30
+ client.should_receive(:send_stats).with("#{Strumbar.application}.foo", value, code, Strumbar.default_rate)
31
+
32
+ if %w(increment decrement).include? method
33
+ client.send method, 'foo'
34
+ else
35
+ client.send method, 'foo', value
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ end
42
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strumbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -86,6 +86,7 @@ extra_rdoc_files: []
86
86
  files:
87
87
  - .gitignore
88
88
  - .travis.yml
89
+ - CHANGELOG.md
89
90
  - Gemfile
90
91
  - LICENSE
91
92
  - README.md
@@ -101,6 +102,7 @@ files:
101
102
  - lib/strumbar/instrumentation/mongoid/runtime_tracker.rb
102
103
  - lib/strumbar/instrumentation/redis.rb
103
104
  - lib/strumbar/version.rb
105
+ - spec/client_spec.rb
104
106
  - spec/instrumentation/mongoid/controller_runtime_spec.rb
105
107
  - spec/instrumentation/mongoid/runtime_tracker_spec.rb
106
108
  - spec/instrumentation/redis_spec.rb
@@ -122,7 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
124
  version: '0'
123
125
  segments:
124
126
  - 0
125
- hash: 4031522421417010496
127
+ hash: -2742179501174448112
126
128
  required_rubygems_version: !ruby/object:Gem::Requirement
127
129
  none: false
128
130
  requirements:
@@ -131,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
133
  version: '0'
132
134
  segments:
133
135
  - 0
134
- hash: 4031522421417010496
136
+ hash: -2742179501174448112
135
137
  requirements: []
136
138
  rubyforge_project:
137
139
  rubygems_version: 1.8.24
@@ -139,6 +141,7 @@ signing_key:
139
141
  specification_version: 3
140
142
  summary: Helper library to strum along in your application.
141
143
  test_files:
144
+ - spec/client_spec.rb
142
145
  - spec/instrumentation/mongoid/controller_runtime_spec.rb
143
146
  - spec/instrumentation/mongoid/runtime_tracker_spec.rb
144
147
  - spec/instrumentation/redis_spec.rb