appstats 0.22.6 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +9 -6
- data/Gemfile.lock.rails2 +1 -1
- data/appstats.gemspec +1 -0
- data/lib/appstats.rb +2 -0
- data/lib/appstats/benchmarker.rb +20 -0
- data/lib/appstats/inmemory_redis.rb +46 -0
- data/lib/appstats/version.rb +1 -1
- data/spec/benchmarker_spec.rb +39 -0
- data/spec/entry_spec.rb +8 -8
- data/spec/inmemory_redis_spec.rb +118 -0
- data/spec/logger_spec.rb +22 -22
- metadata +35 -15
data/Gemfile.lock
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
appstats (0.
|
4
|
+
appstats (0.23.0)
|
5
5
|
daemons
|
6
6
|
net-scp
|
7
7
|
rails (>= 2.3.0)
|
8
|
+
redis
|
8
9
|
|
9
10
|
GEM
|
10
11
|
remote: http://rubygems.org/
|
@@ -52,7 +53,7 @@ GEM
|
|
52
53
|
ruby_parser (~> 2.0.4)
|
53
54
|
sexp_processor (~> 3.0.3)
|
54
55
|
colored (1.2)
|
55
|
-
daemons (1.1.
|
56
|
+
daemons (1.1.4)
|
56
57
|
diff-lcs (1.1.2)
|
57
58
|
erubis (2.6.6)
|
58
59
|
abstract (>= 1.0.0)
|
@@ -95,9 +96,9 @@ GEM
|
|
95
96
|
mysql (2.8.1)
|
96
97
|
net-scp (1.0.4)
|
97
98
|
net-ssh (>= 1.99.1)
|
98
|
-
net-ssh (2.1
|
99
|
-
polyglot (0.3.
|
100
|
-
rack (1.2.
|
99
|
+
net-ssh (2.2.1)
|
100
|
+
polyglot (0.3.2)
|
101
|
+
rack (1.2.4)
|
101
102
|
rack-mount (0.6.14)
|
102
103
|
rack (>= 1.0.0)
|
103
104
|
rack-test (0.5.7)
|
@@ -126,6 +127,7 @@ GEM
|
|
126
127
|
rake (0.8.7)
|
127
128
|
rb-fsevent (0.4.0)
|
128
129
|
rcov (0.9.9)
|
130
|
+
redis (2.2.2)
|
129
131
|
reek (1.2.8)
|
130
132
|
ruby2ruby (~> 1.2)
|
131
133
|
ruby_parser (~> 2.0)
|
@@ -153,7 +155,8 @@ GEM
|
|
153
155
|
syntax (1.0.0)
|
154
156
|
sys-uname (0.8.5)
|
155
157
|
thor (0.14.6)
|
156
|
-
treetop (1.4.
|
158
|
+
treetop (1.4.10)
|
159
|
+
polyglot
|
157
160
|
polyglot (>= 0.3.1)
|
158
161
|
tzinfo (0.3.26)
|
159
162
|
|
data/Gemfile.lock.rails2
CHANGED
data/appstats.gemspec
CHANGED
data/lib/appstats.rb
CHANGED
@@ -4,6 +4,8 @@ require 'rails' unless Object.const_defined?('Rails')
|
|
4
4
|
|
5
5
|
require "#{File.dirname(__FILE__)}/appstats/acts_as_appstatsable"
|
6
6
|
require "#{File.dirname(__FILE__)}/appstats/acts_as_auditable"
|
7
|
+
require "#{File.dirname(__FILE__)}/appstats/benchmarker"
|
8
|
+
require "#{File.dirname(__FILE__)}/appstats/inmemory_redis"
|
7
9
|
require "#{File.dirname(__FILE__)}/appstats/code_injections"
|
8
10
|
require "#{File.dirname(__FILE__)}/appstats/entry"
|
9
11
|
require "#{File.dirname(__FILE__)}/appstats/audit"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "redis"
|
2
|
+
|
3
|
+
module Appstats
|
4
|
+
class Benchmarker
|
5
|
+
|
6
|
+
attr_accessor :redis
|
7
|
+
|
8
|
+
def initialize(data = {})
|
9
|
+
@redis = data[:redis] || Redis.new
|
10
|
+
end
|
11
|
+
|
12
|
+
def record(title,legend,point)
|
13
|
+
redis.multi do
|
14
|
+
redis.sadd "benchmarks", title
|
15
|
+
redis.sadd "benchmarks:#{title}", legend
|
16
|
+
redis.rpush "benchmarks:#{title}:#{legend}", point
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Appstats
|
2
|
+
class InmemoryRedis
|
3
|
+
|
4
|
+
def initialize(data = {})
|
5
|
+
@sets = {}
|
6
|
+
@lists = {}
|
7
|
+
end
|
8
|
+
|
9
|
+
def scard(key)
|
10
|
+
return 0 if @sets[key].nil?
|
11
|
+
@sets[key].size
|
12
|
+
end
|
13
|
+
|
14
|
+
def sadd(key,member)
|
15
|
+
@sets[key] = [] if @sets[key].nil?
|
16
|
+
return false if @sets[key].include?(member)
|
17
|
+
@sets[key] << member
|
18
|
+
true
|
19
|
+
end
|
20
|
+
|
21
|
+
def llen(key)
|
22
|
+
return 0 if @lists[key].nil?
|
23
|
+
@lists[key].size
|
24
|
+
end
|
25
|
+
|
26
|
+
def rpush(key,value)
|
27
|
+
@lists[key] = [] if @lists[key].nil?
|
28
|
+
@lists[key] << value
|
29
|
+
true
|
30
|
+
end
|
31
|
+
|
32
|
+
def lrange(key,start,stop)
|
33
|
+
return [] if @lists[key].nil?
|
34
|
+
start = 0 if start < 0
|
35
|
+
max_stop = llen(key) - 1
|
36
|
+
stop = max_stop if (stop == -1 || stop > max_stop)
|
37
|
+
return [] if start > stop
|
38
|
+
@lists[key][start..stop]
|
39
|
+
end
|
40
|
+
|
41
|
+
def multi
|
42
|
+
yield
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
data/lib/appstats/version.rb
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Appstats
|
4
|
+
describe Benchmarker do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@redis = InmemoryRedis.new
|
8
|
+
@benchmarker = Benchmarker.new(:redis => @redis)
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "#initialize" do
|
12
|
+
|
13
|
+
it "should default to redis" do
|
14
|
+
Benchmarker.new.redis.should_not == nil
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should be settable" do
|
18
|
+
@benchmarker.redis.should == @redis
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "record" do
|
24
|
+
|
25
|
+
it "should track the title, legend, and point" do
|
26
|
+
@benchmarker.record("BuildDuration","Appstats","15")
|
27
|
+
@redis.scard("benchmarks").should == 1
|
28
|
+
@redis.scard("benchmarks:BuildDuration").should == 1
|
29
|
+
@redis.lrange("benchmarks:BuildDuration:Appstats",0,-1).should == ["15"]
|
30
|
+
|
31
|
+
@benchmarker.record("BuildDuration","Appstats","20")
|
32
|
+
@redis.lrange("benchmarks:BuildDuration:Appstats",0,-1).should == ["15","20"]
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
data/spec/entry_spec.rb
CHANGED
@@ -193,18 +193,18 @@ module Appstats
|
|
193
193
|
end
|
194
194
|
|
195
195
|
it "should understand an entry without contexts" do
|
196
|
-
entry = Entry.create_from_logger_string("0.
|
196
|
+
entry = Entry.create_from_logger_string("0.23.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
|
197
197
|
Entry.count.should == @before_count + 1
|
198
198
|
entry.action.should == "address_search"
|
199
|
-
entry.raw_entry.should == "0.
|
199
|
+
entry.raw_entry.should == "0.23.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
|
200
200
|
entry.occurred_at.should == Time.parse("2010-09-21 23:15:20")
|
201
201
|
end
|
202
202
|
|
203
203
|
it "should understand contexts" do
|
204
|
-
entry = Entry.create_from_logger_string("0.
|
204
|
+
entry = Entry.create_from_logger_string("0.23.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
|
205
205
|
Entry.count.should == @before_count + 1
|
206
206
|
entry.action.should == "address_filter"
|
207
|
-
entry.raw_entry.should == "0.
|
207
|
+
entry.raw_entry.should == "0.23.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
|
208
208
|
entry.occurred_at.should == Time.parse("2010-09-21 23:15:20")
|
209
209
|
entry.contexts.size.should == 2
|
210
210
|
entry.contexts[0].context_key = "app_name"
|
@@ -214,10 +214,10 @@ module Appstats
|
|
214
214
|
end
|
215
215
|
|
216
216
|
it "should handle 'action' as a context" do
|
217
|
-
entry = Entry.create_from_logger_string('0.
|
217
|
+
entry = Entry.create_from_logger_string('0.23.0 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : action=save_ovcen : app_name=cdb')
|
218
218
|
Entry.count.should == @before_count + 1
|
219
219
|
entry.action.should == "page-view"
|
220
|
-
entry.raw_entry.should == "0.
|
220
|
+
entry.raw_entry.should == "0.23.0 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : action=save_ovcen : app_name=cdb"
|
221
221
|
entry.occurred_at.should == Time.parse("2011-02-24 12:59:57")
|
222
222
|
entry.contexts.size.should == 2
|
223
223
|
entry.contexts[0].context_key = "action"
|
@@ -228,10 +228,10 @@ module Appstats
|
|
228
228
|
end
|
229
229
|
|
230
230
|
it "should handle multiple of the same 'context'" do
|
231
|
-
entry = Entry.create_from_logger_string('0.
|
231
|
+
entry = Entry.create_from_logger_string('0.23.0 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : app_name=market : app_name=cdb')
|
232
232
|
Entry.count.should == @before_count + 1
|
233
233
|
entry.action.should == "page-view"
|
234
|
-
entry.raw_entry.should == "0.
|
234
|
+
entry.raw_entry.should == "0.23.0 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : app_name=market : app_name=cdb"
|
235
235
|
entry.occurred_at.should == Time.parse("2011-02-24 12:59:57")
|
236
236
|
entry.contexts.size.should == 2
|
237
237
|
entry.contexts[0].context_key = "app_name"
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Appstats
|
4
|
+
describe InmemoryRedis do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@redis = InmemoryRedis.new
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "#sadd" do
|
11
|
+
|
12
|
+
it "should add to the set" do
|
13
|
+
@redis.sadd("benchmarks", "one").should == true
|
14
|
+
@redis.scard("benchmarks").should == 1
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should not allow duplicate" do
|
18
|
+
@redis.sadd("benchmarks", "one").should == true
|
19
|
+
@redis.scard("benchmarks").should == 1
|
20
|
+
@redis.sadd("benchmarks", "one").should == false
|
21
|
+
@redis.scard("benchmarks").should == 1
|
22
|
+
@redis.sadd("benchmarks", "two").should == true
|
23
|
+
@redis.scard("benchmarks").should == 2
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "#scard" do
|
29
|
+
|
30
|
+
it "should handle nil" do
|
31
|
+
@redis.scard(nil).should == 0
|
32
|
+
@redis.scard("").should == 0
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should handle unknown" do
|
36
|
+
@redis.scard("blah").should == 0
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should count" do
|
40
|
+
@redis.scard("benchmarks").should == 0
|
41
|
+
@redis.sadd "benchmarks", "one"
|
42
|
+
@redis.scard("benchmarks").should == 1
|
43
|
+
@redis.sadd "benchmarks", "two"
|
44
|
+
@redis.scard("benchmarks").should == 2
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "#rpush" do
|
51
|
+
|
52
|
+
it "should add the entry" do
|
53
|
+
@redis.llen("x").should == 0
|
54
|
+
@redis.rpush("x", "one").should == true
|
55
|
+
@redis.llen("x").should == 1
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should allow duplicates" do
|
59
|
+
@redis.llen("x").should == 0
|
60
|
+
@redis.rpush("x", "one").should == true
|
61
|
+
@redis.rpush("x", "one").should == true
|
62
|
+
@redis.llen("x").should == 2
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
describe "#lrange" do
|
68
|
+
|
69
|
+
before(:each) do
|
70
|
+
@redis.rpush("x", "one").should == true
|
71
|
+
@redis.rpush("x", "two").should == true
|
72
|
+
@redis.rpush("x", "three").should == true
|
73
|
+
@redis.rpush("x", "four").should == true
|
74
|
+
@redis.rpush("x", "five").should == true
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should support subsets" do
|
78
|
+
@redis.lrange("x",1,2).should == ["two","three"]
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should support full" do
|
82
|
+
@redis.lrange("x",0,-1).should == ["one","two","three","four","five"]
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should invalid ranges" do
|
86
|
+
@redis.lrange("x",2,1).should == []
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should out of bounds" do
|
90
|
+
@redis.lrange("x",-1,1).should == ["one","two"]
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should support nil" do
|
94
|
+
@redis.lrange(nil,0,1).should == []
|
95
|
+
@redis.lrange("",0,1).should == []
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should support unknown" do
|
99
|
+
@redis.lrange("blah",0,1).should == []
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
describe "#multi" do
|
105
|
+
|
106
|
+
it "should perform multiple tasks" do
|
107
|
+
@redis.multi do
|
108
|
+
@redis.rpush("x","one")
|
109
|
+
@redis.rpush("x","two")
|
110
|
+
end
|
111
|
+
@redis.llen("x").should == 2
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
|
116
|
+
|
117
|
+
end
|
118
|
+
end
|
data/spec/logger_spec.rb
CHANGED
@@ -122,12 +122,12 @@ module Appstats
|
|
122
122
|
|
123
123
|
it "should accept numbers" do
|
124
124
|
Appstats::Logger.entry(5, :blah => 6)
|
125
|
-
Appstats::Logger.raw_read.should == ["0.
|
125
|
+
Appstats::Logger.raw_read.should == ["0.23.0 setup[:,=,-n] 2010-09-21 23:15:20 action=5 : blah=6"]
|
126
126
|
end
|
127
127
|
|
128
128
|
it "should accept arrays" do
|
129
129
|
Appstats::Logger.entry('search', :provider => [ 'one', 'two' ])
|
130
|
-
Appstats::Logger.raw_read.should == ["0.
|
130
|
+
Appstats::Logger.raw_read.should == ["0.23.0 setup[:,=,-n] 2010-09-21 23:15:20 action=search : provider=one : provider=two"]
|
131
131
|
end
|
132
132
|
|
133
133
|
|
@@ -137,7 +137,7 @@ module Appstats
|
|
137
137
|
|
138
138
|
it "should look similar to regular entry" do
|
139
139
|
Appstats::Logger.exception_entry(RuntimeError.new("blah"),:on => "login")
|
140
|
-
Appstats::Logger.raw_read.should == ["0.
|
140
|
+
Appstats::Logger.raw_read.should == ["0.23.0 setup[:,=,-n] 2010-09-21 23:15:20 action=appstats-exception : error=blah : on=login"]
|
141
141
|
end
|
142
142
|
|
143
143
|
end
|
@@ -154,47 +154,47 @@ module Appstats
|
|
154
154
|
|
155
155
|
it "should handle a statistics entry" do
|
156
156
|
expected = { :action => "address_search", :timestamp => "2010-09-21 23:15:20" }
|
157
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
157
|
+
actual = Appstats::Logger.entry_to_hash("0.23.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
|
158
158
|
actual.should == expected
|
159
159
|
end
|
160
160
|
|
161
161
|
it "should handle contexts" do
|
162
162
|
expected = { :action => "address_filter", :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => 'Market' }
|
163
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
163
|
+
actual = Appstats::Logger.entry_to_hash("0.23.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
|
164
164
|
actual.should == expected
|
165
165
|
end
|
166
166
|
|
167
167
|
it "should handle multiple actions" do
|
168
168
|
expected = { :action => ["address_filter", "blah"], :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => 'Market' }
|
169
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
169
|
+
actual = Appstats::Logger.entry_to_hash("0.23.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : action=blah : app_name=Market : server=Live")
|
170
170
|
actual.should == expected
|
171
171
|
end
|
172
172
|
|
173
173
|
it "should handle multiple of same context" do
|
174
174
|
expected = { :action => "address_filter", :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => ['Sin','Market'] }
|
175
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
175
|
+
actual = Appstats::Logger.entry_to_hash("0.23.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Sin : app_name=Market : server=Live")
|
176
176
|
actual.should == expected
|
177
177
|
end
|
178
178
|
|
179
179
|
it "should handle no actions" do
|
180
180
|
expected = { :action => "UNKNOWN_ACTION", :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => 'Market' }
|
181
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
181
|
+
actual = Appstats::Logger.entry_to_hash("0.23.0 setup[:,=,-n] 2010-09-21 23:15:20 app_name=Market : server=Live")
|
182
182
|
actual.should == expected
|
183
183
|
end
|
184
184
|
|
185
185
|
it "should handle actions with the delimiter (and change the delimiter)" do
|
186
186
|
expected = { :action => "address:=search-n", :timestamp => "2010-09-21 23:15:20" }
|
187
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
187
|
+
actual = Appstats::Logger.entry_to_hash("0.23.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n")
|
188
188
|
actual.should == expected
|
189
189
|
|
190
190
|
expected = { :action => "address::search==--n", :timestamp => "2010-09-21 23:15:20" }
|
191
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
191
|
+
actual = Appstats::Logger.entry_to_hash("0.23.0 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n")
|
192
192
|
actual.should == expected
|
193
193
|
end
|
194
194
|
|
195
195
|
it "should handle contexts with the delimiter (and change the delimiter)" do
|
196
196
|
expected = { :action => "address", :timestamp => "2010-09-21 23:15:20", :server => "market:eval=-n" }
|
197
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
197
|
+
actual = Appstats::Logger.entry_to_hash("0.23.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n")
|
198
198
|
actual.should == expected
|
199
199
|
end
|
200
200
|
|
@@ -203,66 +203,66 @@ module Appstats
|
|
203
203
|
describe "#entry_to_s" do
|
204
204
|
|
205
205
|
it "should handle a statistics entry" do
|
206
|
-
expected = "0.
|
206
|
+
expected = "0.23.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
|
207
207
|
actual = Appstats::Logger.entry_to_s("address_search")
|
208
208
|
actual.should == expected
|
209
209
|
end
|
210
210
|
|
211
211
|
it "should handle numbers" do
|
212
|
-
expected = "0.
|
212
|
+
expected = "0.23.0 setup[:,=,-n] 2010-09-21 23:15:20 action=1 : note=2.2"
|
213
213
|
actual = Appstats::Logger.entry_to_s(1,:note => 2.2)
|
214
214
|
actual.should == expected
|
215
215
|
end
|
216
216
|
|
217
217
|
it "should handle default contexts" do
|
218
218
|
Appstats::Logger.default_contexts[:app_name] = "market"
|
219
|
-
expected = "0.
|
219
|
+
expected = "0.23.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : app_name=market"
|
220
220
|
actual = Appstats::Logger.entry_to_s("address_search")
|
221
221
|
actual.should == expected
|
222
222
|
end
|
223
223
|
|
224
224
|
it "should handle contexts (and sort them by symbol)" do
|
225
|
-
expected = "0.
|
225
|
+
expected = "0.23.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
|
226
226
|
actual = Appstats::Logger.entry_to_s("address_filter", { :server => "Live", :app_name => 'Market' })
|
227
227
|
actual.should == expected
|
228
228
|
end
|
229
229
|
|
230
230
|
it "should handle actions with the delimiter (and change the delimiter)" do
|
231
|
-
expected = "0.
|
231
|
+
expected = "0.23.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n"
|
232
232
|
actual = Appstats::Logger.entry_to_s("address:=search-n")
|
233
233
|
actual.should == expected
|
234
234
|
|
235
|
-
expected = "0.
|
235
|
+
expected = "0.23.0 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n"
|
236
236
|
actual = Appstats::Logger.entry_to_s("address::search==--n")
|
237
237
|
actual.should == expected
|
238
238
|
end
|
239
239
|
|
240
240
|
it "should handle contexts with the delimiter (and change the delimiter)" do
|
241
|
-
expected = "0.
|
241
|
+
expected = "0.23.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n"
|
242
242
|
actual = Appstats::Logger.entry_to_s("address", :server => 'market:eval=-n')
|
243
243
|
actual.should == expected
|
244
244
|
end
|
245
245
|
|
246
246
|
it "should ignore spaces" do
|
247
|
-
expected = "0.
|
247
|
+
expected = "0.23.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address search"
|
248
248
|
actual = Appstats::Logger.entry_to_s("address search")
|
249
249
|
actual.should == expected
|
250
250
|
end
|
251
251
|
|
252
252
|
it "should convert newlines in action" do
|
253
|
-
expected = "0.
|
253
|
+
expected = "0.23.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_-nsearch"
|
254
254
|
actual = Appstats::Logger.entry_to_s("address_\nsearch")
|
255
255
|
actual.should == expected
|
256
256
|
end
|
257
257
|
|
258
258
|
it "should convert newlines in context" do
|
259
|
-
expected = "0.
|
259
|
+
expected = "0.23.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : blah=some-nlong-nstatement"
|
260
260
|
actual = Appstats::Logger.entry_to_s("address_search",:blah => "some\nlong\nstatement")
|
261
261
|
actual.should == expected
|
262
262
|
end
|
263
263
|
|
264
264
|
it "should convert newlines based on the delimiter" do
|
265
|
-
expected = "0.
|
265
|
+
expected = "0.23.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=--nsearch-n"
|
266
266
|
actual = Appstats::Logger.entry_to_s("address:=\nsearch-n")
|
267
267
|
actual.should == expected
|
268
268
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appstats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 67
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 23
|
9
|
+
- 0
|
10
|
+
version: 0.23.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrew Forward
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-09-30 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rails
|
@@ -62,7 +62,7 @@ dependencies:
|
|
62
62
|
type: :runtime
|
63
63
|
version_requirements: *id003
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
|
-
name:
|
65
|
+
name: redis
|
66
66
|
prerelease: false
|
67
67
|
requirement: &id004 !ruby/object:Gem::Requirement
|
68
68
|
none: false
|
@@ -73,10 +73,10 @@ dependencies:
|
|
73
73
|
segments:
|
74
74
|
- 0
|
75
75
|
version: "0"
|
76
|
-
type: :
|
76
|
+
type: :runtime
|
77
77
|
version_requirements: *id004
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
79
|
+
name: rake
|
80
80
|
prerelease: false
|
81
81
|
requirement: &id005 !ruby/object:Gem::Requirement
|
82
82
|
none: false
|
@@ -90,7 +90,7 @@ dependencies:
|
|
90
90
|
type: :development
|
91
91
|
version_requirements: *id005
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
|
-
name:
|
93
|
+
name: rspec
|
94
94
|
prerelease: false
|
95
95
|
requirement: &id006 !ruby/object:Gem::Requirement
|
96
96
|
none: false
|
@@ -104,7 +104,7 @@ dependencies:
|
|
104
104
|
type: :development
|
105
105
|
version_requirements: *id006
|
106
106
|
- !ruby/object:Gem::Dependency
|
107
|
-
name:
|
107
|
+
name: ZenTest
|
108
108
|
prerelease: false
|
109
109
|
requirement: &id007 !ruby/object:Gem::Requirement
|
110
110
|
none: false
|
@@ -118,7 +118,7 @@ dependencies:
|
|
118
118
|
type: :development
|
119
119
|
version_requirements: *id007
|
120
120
|
- !ruby/object:Gem::Dependency
|
121
|
-
name:
|
121
|
+
name: standalone_migrations
|
122
122
|
prerelease: false
|
123
123
|
requirement: &id008 !ruby/object:Gem::Requirement
|
124
124
|
none: false
|
@@ -132,7 +132,7 @@ dependencies:
|
|
132
132
|
type: :development
|
133
133
|
version_requirements: *id008
|
134
134
|
- !ruby/object:Gem::Dependency
|
135
|
-
name:
|
135
|
+
name: mysql
|
136
136
|
prerelease: false
|
137
137
|
requirement: &id009 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
@@ -146,7 +146,7 @@ dependencies:
|
|
146
146
|
type: :development
|
147
147
|
version_requirements: *id009
|
148
148
|
- !ruby/object:Gem::Dependency
|
149
|
-
name:
|
149
|
+
name: metric_fu
|
150
150
|
prerelease: false
|
151
151
|
requirement: &id010 !ruby/object:Gem::Requirement
|
152
152
|
none: false
|
@@ -160,7 +160,7 @@ dependencies:
|
|
160
160
|
type: :development
|
161
161
|
version_requirements: *id010
|
162
162
|
- !ruby/object:Gem::Dependency
|
163
|
-
name:
|
163
|
+
name: guard-rspec
|
164
164
|
prerelease: false
|
165
165
|
requirement: &id011 !ruby/object:Gem::Requirement
|
166
166
|
none: false
|
@@ -174,7 +174,7 @@ dependencies:
|
|
174
174
|
type: :development
|
175
175
|
version_requirements: *id011
|
176
176
|
- !ruby/object:Gem::Dependency
|
177
|
-
name:
|
177
|
+
name: autotest-fsevent
|
178
178
|
prerelease: false
|
179
179
|
requirement: &id012 !ruby/object:Gem::Requirement
|
180
180
|
none: false
|
@@ -187,6 +187,20 @@ dependencies:
|
|
187
187
|
version: "0"
|
188
188
|
type: :development
|
189
189
|
version_requirements: *id012
|
190
|
+
- !ruby/object:Gem::Dependency
|
191
|
+
name: rb-fsevent
|
192
|
+
prerelease: false
|
193
|
+
requirement: &id013 !ruby/object:Gem::Requirement
|
194
|
+
none: false
|
195
|
+
requirements:
|
196
|
+
- - ">="
|
197
|
+
- !ruby/object:Gem::Version
|
198
|
+
hash: 3
|
199
|
+
segments:
|
200
|
+
- 0
|
201
|
+
version: "0"
|
202
|
+
type: :development
|
203
|
+
version_requirements: *id013
|
190
204
|
description: Provide usage statistics about how your application is being used
|
191
205
|
email:
|
192
206
|
- aforward@gmail.com
|
@@ -247,6 +261,7 @@ files:
|
|
247
261
|
- lib/appstats/acts_as_auditable.rb
|
248
262
|
- lib/appstats/appstats_query.rb
|
249
263
|
- lib/appstats/audit.rb
|
264
|
+
- lib/appstats/benchmarker.rb
|
250
265
|
- lib/appstats/ci.rake
|
251
266
|
- lib/appstats/code_injections.rb
|
252
267
|
- lib/appstats/context.rb
|
@@ -257,6 +272,7 @@ files:
|
|
257
272
|
- lib/appstats/entry_date.rb
|
258
273
|
- lib/appstats/friendly_timer.rb
|
259
274
|
- lib/appstats/host.rb
|
275
|
+
- lib/appstats/inmemory_redis.rb
|
260
276
|
- lib/appstats/log_collector.rb
|
261
277
|
- lib/appstats/logger.rb
|
262
278
|
- lib/appstats/parser.rb
|
@@ -283,6 +299,7 @@ files:
|
|
283
299
|
- spec/appstats_query_spec.rb
|
284
300
|
- spec/appstats_spec.rb
|
285
301
|
- spec/audit_spec.rb
|
302
|
+
- spec/benchmarker_spec.rb
|
286
303
|
- spec/context_key_spec.rb
|
287
304
|
- spec/context_spec.rb
|
288
305
|
- spec/context_value_spec.rb
|
@@ -291,6 +308,7 @@ files:
|
|
291
308
|
- spec/entry_spec.rb
|
292
309
|
- spec/friendly_timer_spec.rb
|
293
310
|
- spec/host_spec.rb
|
311
|
+
- spec/inmemory_redis_spec.rb
|
294
312
|
- spec/log_collector_spec.rb
|
295
313
|
- spec/logger_spec.rb
|
296
314
|
- spec/parser_spec.rb
|
@@ -341,6 +359,7 @@ test_files:
|
|
341
359
|
- spec/appstats_query_spec.rb
|
342
360
|
- spec/appstats_spec.rb
|
343
361
|
- spec/audit_spec.rb
|
362
|
+
- spec/benchmarker_spec.rb
|
344
363
|
- spec/context_key_spec.rb
|
345
364
|
- spec/context_spec.rb
|
346
365
|
- spec/context_value_spec.rb
|
@@ -349,6 +368,7 @@ test_files:
|
|
349
368
|
- spec/entry_spec.rb
|
350
369
|
- spec/friendly_timer_spec.rb
|
351
370
|
- spec/host_spec.rb
|
371
|
+
- spec/inmemory_redis_spec.rb
|
352
372
|
- spec/log_collector_spec.rb
|
353
373
|
- spec/logger_spec.rb
|
354
374
|
- spec/parser_spec.rb
|