appstats 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -1
- data/Gemfile.lock +1 -1
- data/config/appstats.yml.example +18 -0
- data/config/daemons.yml +6 -0
- data/config/initializers/appstats.rb.example +3 -0
- data/lib/appstats/version.rb +1 -1
- data/spec/entry_spec.rb +4 -4
- data/spec/logger_spec.rb +16 -16
- metadata +6 -3
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
database:
|
2
|
+
adapter: mysql
|
3
|
+
database: mystatsdb_production
|
4
|
+
username: root
|
5
|
+
password:
|
6
|
+
host: localhost
|
7
|
+
encoding: utf8
|
8
|
+
remote_servers:
|
9
|
+
- :host: my.remoteserver.com
|
10
|
+
:user: deploy
|
11
|
+
:password: abc123
|
12
|
+
:path: /home/deploy/rails/myapp/current/log
|
13
|
+
:template: appstats
|
14
|
+
- :host: jobs.remoteserver.com
|
15
|
+
:user: deploy
|
16
|
+
:password: abc123
|
17
|
+
:path: /home/deploy/rails/myotherapp/current/log
|
18
|
+
:template: appstats
|
data/config/daemons.yml
ADDED
data/lib/appstats/version.rb
CHANGED
data/spec/entry_spec.rb
CHANGED
@@ -143,18 +143,18 @@ module Appstats
|
|
143
143
|
end
|
144
144
|
|
145
145
|
it "should understand an entry without contexts" do
|
146
|
-
entry = Entry.load_from_logger_entry("0.0.
|
146
|
+
entry = Entry.load_from_logger_entry("0.0.16 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
|
147
147
|
Entry.count.should == @before_count + 1
|
148
148
|
entry.action.should == "address_search"
|
149
|
-
entry.raw_entry.should == "0.0.
|
149
|
+
entry.raw_entry.should == "0.0.16 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
|
150
150
|
entry.occurred_at.should == Time.parse("2010-09-21 23:15:20")
|
151
151
|
end
|
152
152
|
|
153
153
|
it "should understand contexts" do
|
154
|
-
entry = Entry.load_from_logger_entry("0.0.
|
154
|
+
entry = Entry.load_from_logger_entry("0.0.16 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
|
155
155
|
Entry.count.should == @before_count + 1
|
156
156
|
entry.action.should == "address_filter"
|
157
|
-
entry.raw_entry.should == "0.0.
|
157
|
+
entry.raw_entry.should == "0.0.16 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
|
158
158
|
entry.occurred_at.should == Time.parse("2010-09-21 23:15:20")
|
159
159
|
entry.contexts.size.should == 2
|
160
160
|
entry.contexts[0].context_key = "app_name"
|
data/spec/logger_spec.rb
CHANGED
@@ -127,29 +127,29 @@ 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.16 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.16 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.16 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.16 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.16 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n")
|
153
153
|
actual.should == expected
|
154
154
|
end
|
155
155
|
|
@@ -158,66 +158,66 @@ module Appstats
|
|
158
158
|
describe "#entry_to_s" do
|
159
159
|
|
160
160
|
it "should handle a statistics entry" do
|
161
|
-
expected = "0.0.
|
161
|
+
expected = "0.0.16 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
|
162
162
|
actual = Appstats::Logger.entry_to_s("address_search")
|
163
163
|
actual.should == expected
|
164
164
|
end
|
165
165
|
|
166
166
|
it "should handle numbers" do
|
167
|
-
expected = "0.0.
|
167
|
+
expected = "0.0.16 setup[:,=,-n] 2010-09-21 23:15:20 action=1 : note=2.2"
|
168
168
|
actual = Appstats::Logger.entry_to_s(1,:note => 2.2)
|
169
169
|
actual.should == expected
|
170
170
|
end
|
171
171
|
|
172
172
|
it "should handle default contexts" do
|
173
173
|
Appstats::Logger.default_contexts[:app_name] = "market"
|
174
|
-
expected = "0.0.
|
174
|
+
expected = "0.0.16 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : app_name=market"
|
175
175
|
actual = Appstats::Logger.entry_to_s("address_search")
|
176
176
|
actual.should == expected
|
177
177
|
end
|
178
178
|
|
179
179
|
it "should handle contexts (and sort them by symbol)" do
|
180
|
-
expected = "0.0.
|
180
|
+
expected = "0.0.16 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
|
181
181
|
actual = Appstats::Logger.entry_to_s("address_filter", { :server => "Live", :app_name => 'Market' })
|
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
|
-
expected = "0.0.
|
186
|
+
expected = "0.0.16 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n"
|
187
187
|
actual = Appstats::Logger.entry_to_s("address:=search-n")
|
188
188
|
actual.should == expected
|
189
189
|
|
190
|
-
expected = "0.0.
|
190
|
+
expected = "0.0.16 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n"
|
191
191
|
actual = Appstats::Logger.entry_to_s("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
|
-
expected = "0.0.
|
196
|
+
expected = "0.0.16 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n"
|
197
197
|
actual = Appstats::Logger.entry_to_s("address", :server => 'market:eval=-n')
|
198
198
|
actual.should == expected
|
199
199
|
end
|
200
200
|
|
201
201
|
it "should ignore spaces" do
|
202
|
-
expected = "0.0.
|
202
|
+
expected = "0.0.16 setup[:,=,-n] 2010-09-21 23:15:20 action=address search"
|
203
203
|
actual = Appstats::Logger.entry_to_s("address search")
|
204
204
|
actual.should == expected
|
205
205
|
end
|
206
206
|
|
207
207
|
it "should convert newlines in action" do
|
208
|
-
expected = "0.0.
|
208
|
+
expected = "0.0.16 setup[:,=,-n] 2010-09-21 23:15:20 action=address_-nsearch"
|
209
209
|
actual = Appstats::Logger.entry_to_s("address_\nsearch")
|
210
210
|
actual.should == expected
|
211
211
|
end
|
212
212
|
|
213
213
|
it "should convert newlines in context" do
|
214
|
-
expected = "0.0.
|
214
|
+
expected = "0.0.16 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : blah=some-nlong-nstatement"
|
215
215
|
actual = Appstats::Logger.entry_to_s("address_search",:blah => "some\nlong\nstatement")
|
216
216
|
actual.should == expected
|
217
217
|
end
|
218
218
|
|
219
219
|
it "should convert newlines based on the delimiter" do
|
220
|
-
expected = "0.0.
|
220
|
+
expected = "0.0.16 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=--nsearch-n"
|
221
221
|
actual = Appstats::Logger.entry_to_s("address:=\nsearch-n")
|
222
222
|
actual.should == expected
|
223
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: 63
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 16
|
10
|
+
version: 0.0.16
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrew Forward
|
@@ -137,6 +137,9 @@ files:
|
|
137
137
|
- Rakefile
|
138
138
|
- appstats.gemspec
|
139
139
|
- autotest/discover.rb
|
140
|
+
- config/appstats.yml.example
|
141
|
+
- config/daemons.yml
|
142
|
+
- config/initializers/appstats.rb.example
|
140
143
|
- db/config.yml
|
141
144
|
- db/migrations/20110105221941_create_appstats_entries.rb
|
142
145
|
- db/migrations/20110203151136_create_appstats_contexts.rb
|