appstats 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/Gemfile.lock +8 -2
- data/appstats.gemspec +2 -1
- data/db/config.yml +1 -1
- data/db/migrations/20110203151136_create_appstats_contexts.rb +16 -0
- data/db/migrations/20110203151635_rework_appstats_entries.rb +21 -0
- data/db/migrations/20110204183259_create_log_collectors.rb +16 -0
- data/db/schema.rb +23 -4
- data/lib/appstats.rb +14 -2
- data/lib/appstats/context.rb +26 -0
- data/lib/appstats/entry.rb +31 -2
- data/lib/appstats/log_collector.rb +124 -0
- data/lib/appstats/version.rb +1 -1
- data/lib/daemons/appstats_log_collector +0 -0
- data/lib/daemons/appstats_log_collector.rb +42 -0
- data/lib/daemons/appstats_log_collector_ctl +25 -0
- data/spec/context_spec.rb +123 -0
- data/spec/entry_spec.rb +162 -17
- data/spec/log_collector_spec.rb +284 -0
- data/spec/logger_spec.rb +16 -17
- metadata +50 -10
data/spec/logger_spec.rb
CHANGED
@@ -127,98 +127,97 @@ module Appstats
|
|
127
127
|
|
128
128
|
it "should handle a statistics entry" do
|
129
129
|
expected = { :action => "address_search", :timestamp => "2010-09-21 23:15:20" }
|
130
|
-
actual = Appstats::Logger.entry_to_hash("0.0.
|
130
|
+
actual = Appstats::Logger.entry_to_hash("0.0.14 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
|
131
131
|
actual.should == expected
|
132
132
|
end
|
133
133
|
|
134
134
|
it "should handle contexts" do
|
135
135
|
expected = { :action => "address_filter", :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => 'Market' }
|
136
|
-
actual = Appstats::Logger.entry_to_hash("0.0.
|
136
|
+
actual = Appstats::Logger.entry_to_hash("0.0.14 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
|
137
137
|
actual.should == expected
|
138
138
|
end
|
139
139
|
|
140
140
|
it "should handle actions with the delimiter (and change the delimiter)" do
|
141
141
|
expected = { :action => "address:=search-n", :timestamp => "2010-09-21 23:15:20" }
|
142
|
-
actual = Appstats::Logger.entry_to_hash("0.0.
|
142
|
+
actual = Appstats::Logger.entry_to_hash("0.0.14 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n")
|
143
143
|
actual.should == expected
|
144
144
|
|
145
145
|
expected = { :action => "address::search==--n", :timestamp => "2010-09-21 23:15:20" }
|
146
|
-
actual = Appstats::Logger.entry_to_hash("0.0.
|
146
|
+
actual = Appstats::Logger.entry_to_hash("0.0.14 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n")
|
147
147
|
actual.should == expected
|
148
148
|
end
|
149
149
|
|
150
150
|
it "should handle contexts with the delimiter (and change the delimiter)" do
|
151
151
|
expected = { :action => "address", :timestamp => "2010-09-21 23:15:20", :server => "market:eval=-n" }
|
152
|
-
actual = Appstats::Logger.entry_to_hash("0.0.
|
152
|
+
actual = Appstats::Logger.entry_to_hash("0.0.14 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n")
|
153
153
|
actual.should == expected
|
154
154
|
end
|
155
|
-
|
156
155
|
|
157
156
|
end
|
158
157
|
|
159
158
|
describe "#entry_to_s" do
|
160
159
|
|
161
160
|
it "should handle a statistics entry" do
|
162
|
-
expected = "0.0.
|
161
|
+
expected = "0.0.14 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
|
163
162
|
actual = Appstats::Logger.entry_to_s("address_search")
|
164
163
|
actual.should == expected
|
165
164
|
end
|
166
165
|
|
167
166
|
it "should handle numbers" do
|
168
|
-
expected = "0.0.
|
167
|
+
expected = "0.0.14 setup[:,=,-n] 2010-09-21 23:15:20 action=1 : note=2.2"
|
169
168
|
actual = Appstats::Logger.entry_to_s(1,:note => 2.2)
|
170
169
|
actual.should == expected
|
171
170
|
end
|
172
171
|
|
173
172
|
it "should handle default contexts" do
|
174
173
|
Appstats::Logger.default_contexts[:app_name] = "market"
|
175
|
-
expected = "0.0.
|
174
|
+
expected = "0.0.14 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : app_name=market"
|
176
175
|
actual = Appstats::Logger.entry_to_s("address_search")
|
177
176
|
actual.should == expected
|
178
177
|
end
|
179
178
|
|
180
179
|
it "should handle contexts (and sort them by symbol)" do
|
181
|
-
expected = "0.0.
|
180
|
+
expected = "0.0.14 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
|
182
181
|
actual = Appstats::Logger.entry_to_s("address_filter", { :server => "Live", :app_name => 'Market' })
|
183
182
|
actual.should == expected
|
184
183
|
end
|
185
184
|
|
186
185
|
it "should handle actions with the delimiter (and change the delimiter)" do
|
187
|
-
expected = "0.0.
|
186
|
+
expected = "0.0.14 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n"
|
188
187
|
actual = Appstats::Logger.entry_to_s("address:=search-n")
|
189
188
|
actual.should == expected
|
190
189
|
|
191
|
-
expected = "0.0.
|
190
|
+
expected = "0.0.14 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n"
|
192
191
|
actual = Appstats::Logger.entry_to_s("address::search==--n")
|
193
192
|
actual.should == expected
|
194
193
|
end
|
195
194
|
|
196
195
|
it "should handle contexts with the delimiter (and change the delimiter)" do
|
197
|
-
expected = "0.0.
|
196
|
+
expected = "0.0.14 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n"
|
198
197
|
actual = Appstats::Logger.entry_to_s("address", :server => 'market:eval=-n')
|
199
198
|
actual.should == expected
|
200
199
|
end
|
201
200
|
|
202
201
|
it "should ignore spaces" do
|
203
|
-
expected = "0.0.
|
202
|
+
expected = "0.0.14 setup[:,=,-n] 2010-09-21 23:15:20 action=address search"
|
204
203
|
actual = Appstats::Logger.entry_to_s("address search")
|
205
204
|
actual.should == expected
|
206
205
|
end
|
207
206
|
|
208
207
|
it "should convert newlines in action" do
|
209
|
-
expected = "0.0.
|
208
|
+
expected = "0.0.14 setup[:,=,-n] 2010-09-21 23:15:20 action=address_-nsearch"
|
210
209
|
actual = Appstats::Logger.entry_to_s("address_\nsearch")
|
211
210
|
actual.should == expected
|
212
211
|
end
|
213
212
|
|
214
213
|
it "should convert newlines in context" do
|
215
|
-
expected = "0.0.
|
214
|
+
expected = "0.0.14 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : blah=some-nlong-nstatement"
|
216
215
|
actual = Appstats::Logger.entry_to_s("address_search",:blah => "some\nlong\nstatement")
|
217
216
|
actual.should == expected
|
218
217
|
end
|
219
218
|
|
220
219
|
it "should convert newlines based on the delimiter" do
|
221
|
-
expected = "0.0.
|
220
|
+
expected = "0.0.14 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=--nsearch-n"
|
222
221
|
actual = Appstats::Logger.entry_to_s("address:=\nsearch-n")
|
223
222
|
actual.should == expected
|
224
223
|
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: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 14
|
10
|
+
version: 0.0.14
|
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-02-
|
18
|
+
date: 2011-02-04 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -35,7 +35,7 @@ dependencies:
|
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
38
|
+
name: daemons
|
39
39
|
prerelease: false
|
40
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
@@ -46,10 +46,10 @@ dependencies:
|
|
46
46
|
segments:
|
47
47
|
- 0
|
48
48
|
version: "0"
|
49
|
-
type: :
|
49
|
+
type: :runtime
|
50
50
|
version_requirements: *id002
|
51
51
|
- !ruby/object:Gem::Dependency
|
52
|
-
name:
|
52
|
+
name: net-scp
|
53
53
|
prerelease: false
|
54
54
|
requirement: &id003 !ruby/object:Gem::Requirement
|
55
55
|
none: false
|
@@ -60,10 +60,10 @@ dependencies:
|
|
60
60
|
segments:
|
61
61
|
- 0
|
62
62
|
version: "0"
|
63
|
-
type: :
|
63
|
+
type: :runtime
|
64
64
|
version_requirements: *id003
|
65
65
|
- !ruby/object:Gem::Dependency
|
66
|
-
name:
|
66
|
+
name: rspec
|
67
67
|
prerelease: false
|
68
68
|
requirement: &id004 !ruby/object:Gem::Requirement
|
69
69
|
none: false
|
@@ -77,7 +77,7 @@ dependencies:
|
|
77
77
|
type: :development
|
78
78
|
version_requirements: *id004
|
79
79
|
- !ruby/object:Gem::Dependency
|
80
|
-
name:
|
80
|
+
name: ZenTest
|
81
81
|
prerelease: false
|
82
82
|
requirement: &id005 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
@@ -90,6 +90,34 @@ dependencies:
|
|
90
90
|
version: "0"
|
91
91
|
type: :development
|
92
92
|
version_requirements: *id005
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: standalone_migrations
|
95
|
+
prerelease: false
|
96
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
hash: 3
|
102
|
+
segments:
|
103
|
+
- 0
|
104
|
+
version: "0"
|
105
|
+
type: :development
|
106
|
+
version_requirements: *id006
|
107
|
+
- !ruby/object:Gem::Dependency
|
108
|
+
name: mysql
|
109
|
+
prerelease: false
|
110
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
hash: 3
|
116
|
+
segments:
|
117
|
+
- 0
|
118
|
+
version: "0"
|
119
|
+
type: :development
|
120
|
+
version_requirements: *id007
|
93
121
|
description: Provide usage statistics about how your application is being used
|
94
122
|
email:
|
95
123
|
- aforward@gmail.com
|
@@ -111,13 +139,21 @@ files:
|
|
111
139
|
- autotest/discover.rb
|
112
140
|
- db/config.yml
|
113
141
|
- db/migrations/20110105221941_create_appstats_entries.rb
|
142
|
+
- db/migrations/20110203151136_create_appstats_contexts.rb
|
143
|
+
- db/migrations/20110203151635_rework_appstats_entries.rb
|
144
|
+
- db/migrations/20110204183259_create_log_collectors.rb
|
114
145
|
- db/schema.rb
|
115
146
|
- lib/appstats.rb
|
116
147
|
- lib/appstats/code_injections.rb
|
148
|
+
- lib/appstats/context.rb
|
117
149
|
- lib/appstats/entry.rb
|
150
|
+
- lib/appstats/log_collector.rb
|
118
151
|
- lib/appstats/logger.rb
|
119
152
|
- lib/appstats/tasks.rb
|
120
153
|
- lib/appstats/version.rb
|
154
|
+
- lib/daemons/appstats_log_collector
|
155
|
+
- lib/daemons/appstats_log_collector.rb
|
156
|
+
- lib/daemons/appstats_log_collector_ctl
|
121
157
|
- lib/templates/appstats_config.rb
|
122
158
|
- pkg/appstats-0.0.1.gem
|
123
159
|
- pkg/appstats-0.0.1.tgz
|
@@ -136,7 +172,9 @@ files:
|
|
136
172
|
- script/destroy
|
137
173
|
- script/generate
|
138
174
|
- spec/appstats_spec.rb
|
175
|
+
- spec/context_spec.rb
|
139
176
|
- spec/entry_spec.rb
|
177
|
+
- spec/log_collector_spec.rb
|
140
178
|
- spec/logger_spec.rb
|
141
179
|
- spec/spec_helper.rb
|
142
180
|
has_rdoc: true
|
@@ -175,6 +213,8 @@ specification_version: 3
|
|
175
213
|
summary: Provide usage statistics about how your application is being used
|
176
214
|
test_files:
|
177
215
|
- spec/appstats_spec.rb
|
216
|
+
- spec/context_spec.rb
|
178
217
|
- spec/entry_spec.rb
|
218
|
+
- spec/log_collector_spec.rb
|
179
219
|
- spec/logger_spec.rb
|
180
220
|
- spec/spec_helper.rb
|