appstats 0.13.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- appstats (0.13.0)
4
+ appstats (0.13.1)
5
5
  daemons
6
6
  net-scp
7
7
  rails (>= 2.3.0)
@@ -1,3 +1,3 @@
1
1
  module Appstats
2
- VERSION = "0.13.0"
2
+ VERSION = "0.13.1"
3
3
  end
@@ -29,9 +29,16 @@ end
29
29
  appstats_config = YAML::load(File.open(options[:config]))
30
30
  ActiveRecord::Base.establish_connection(appstats_config['database'])
31
31
  require File.join(File.dirname(__FILE__),"..","appstats")
32
-
33
32
  last_processed_at = nil
34
33
  Appstats.log(:info,"Started Appstats Log Collector")
34
+
35
+ if appstats_config['downloaded_log_directory'].nil?
36
+ Appstats.log(:info,"Logs will be downloaded to default directory (downloaded_log_directory in config file to overwrite")
37
+ else
38
+ Appstats::LogCollector.downloaded_log_directory = appstats_config['downloaded_log_directory']
39
+ Appstats.log(:info,"Logs will be downloaded to #{Appstats::LogCollector.downloaded_log_directory}")
40
+ end
41
+
35
42
  while($running) do
36
43
  unless Appstats::LogCollector.should_process(last_processed_at)
37
44
  an_hour = 60*60
@@ -0,0 +1,19 @@
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
19
+ downloaded_log_directory: /tmp
@@ -2,6 +2,3 @@
2
2
  # LOGGER CONFIGURATIONS (i.e. what is integrated within all of your apps)
3
3
  Appstats::Logger.filename_template = "log/appstats" # usually left as-is
4
4
  Appstats::Logger.default_contexts[:app_name] = "YOUR_APP_NAME_HERE" # replace me with your app name
5
-
6
- # LOG COLLECTOR (i.e. the process / app that downloads all remote logs and processed them)
7
- Appstats::LogCollector.downloaded_log_directory = "/tmp" # only required for consolidated app
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.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
196
+ entry = Entry.create_from_logger_string("0.13.1 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.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
199
+ entry.raw_entry.should == "0.13.1 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.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
204
+ entry = Entry.create_from_logger_string("0.13.1 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.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
207
+ entry.raw_entry.should == "0.13.1 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.13.0 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : action=save_ovcen : app_name=cdb')
217
+ entry = Entry.create_from_logger_string('0.13.1 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.13.0 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : action=save_ovcen : app_name=cdb"
220
+ entry.raw_entry.should == "0.13.1 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.13.0 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : app_name=market : app_name=cdb')
231
+ entry = Entry.create_from_logger_string('0.13.1 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.13.0 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : app_name=market : app_name=cdb"
234
+ entry.raw_entry.should == "0.13.1 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"
data/spec/logger_spec.rb CHANGED
@@ -115,7 +115,7 @@ module Appstats
115
115
 
116
116
  it "should accept numbers" do
117
117
  Appstats::Logger.entry(5, :blah => 6)
118
- Appstats::Logger.raw_read.should == ["0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=5 : blah=6"]
118
+ Appstats::Logger.raw_read.should == ["0.13.1 setup[:,=,-n] 2010-09-21 23:15:20 action=5 : blah=6"]
119
119
  end
120
120
 
121
121
  end
@@ -124,7 +124,7 @@ module Appstats
124
124
 
125
125
  it "should look similar to regular entry" do
126
126
  Appstats::Logger.exception_entry(RuntimeError.new("blah"),:on => "login")
127
- Appstats::Logger.raw_read.should == ["0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=appstats-exception : error=blah : on=login"]
127
+ Appstats::Logger.raw_read.should == ["0.13.1 setup[:,=,-n] 2010-09-21 23:15:20 action=appstats-exception : error=blah : on=login"]
128
128
  end
129
129
 
130
130
  end
@@ -141,47 +141,47 @@ module Appstats
141
141
 
142
142
  it "should handle a statistics entry" do
143
143
  expected = { :action => "address_search", :timestamp => "2010-09-21 23:15:20" }
144
- actual = Appstats::Logger.entry_to_hash("0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
144
+ actual = Appstats::Logger.entry_to_hash("0.13.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
145
145
  actual.should == expected
146
146
  end
147
147
 
148
148
  it "should handle contexts" do
149
149
  expected = { :action => "address_filter", :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => 'Market' }
150
- actual = Appstats::Logger.entry_to_hash("0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
150
+ actual = Appstats::Logger.entry_to_hash("0.13.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
151
151
  actual.should == expected
152
152
  end
153
153
 
154
154
  it "should handle multiple actions" do
155
155
  expected = { :action => ["address_filter", "blah"], :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => 'Market' }
156
- actual = Appstats::Logger.entry_to_hash("0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : action=blah : app_name=Market : server=Live")
156
+ actual = Appstats::Logger.entry_to_hash("0.13.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : action=blah : app_name=Market : server=Live")
157
157
  actual.should == expected
158
158
  end
159
159
 
160
160
  it "should handle multiple of same context" do
161
161
  expected = { :action => "address_filter", :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => ['Sin','Market'] }
162
- actual = Appstats::Logger.entry_to_hash("0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Sin : app_name=Market : server=Live")
162
+ actual = Appstats::Logger.entry_to_hash("0.13.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Sin : app_name=Market : server=Live")
163
163
  actual.should == expected
164
164
  end
165
165
 
166
166
  it "should handle no actions" do
167
167
  expected = { :action => "UNKNOWN_ACTION", :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => 'Market' }
168
- actual = Appstats::Logger.entry_to_hash("0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 app_name=Market : server=Live")
168
+ actual = Appstats::Logger.entry_to_hash("0.13.1 setup[:,=,-n] 2010-09-21 23:15:20 app_name=Market : server=Live")
169
169
  actual.should == expected
170
170
  end
171
171
 
172
172
  it "should handle actions with the delimiter (and change the delimiter)" do
173
173
  expected = { :action => "address:=search-n", :timestamp => "2010-09-21 23:15:20" }
174
- actual = Appstats::Logger.entry_to_hash("0.13.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n")
174
+ actual = Appstats::Logger.entry_to_hash("0.13.1 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n")
175
175
  actual.should == expected
176
176
 
177
177
  expected = { :action => "address::search==--n", :timestamp => "2010-09-21 23:15:20" }
178
- actual = Appstats::Logger.entry_to_hash("0.13.0 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n")
178
+ actual = Appstats::Logger.entry_to_hash("0.13.1 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n")
179
179
  actual.should == expected
180
180
  end
181
181
 
182
182
  it "should handle contexts with the delimiter (and change the delimiter)" do
183
183
  expected = { :action => "address", :timestamp => "2010-09-21 23:15:20", :server => "market:eval=-n" }
184
- actual = Appstats::Logger.entry_to_hash("0.13.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n")
184
+ actual = Appstats::Logger.entry_to_hash("0.13.1 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n")
185
185
  actual.should == expected
186
186
  end
187
187
 
@@ -190,66 +190,66 @@ module Appstats
190
190
  describe "#entry_to_s" do
191
191
 
192
192
  it "should handle a statistics entry" do
193
- expected = "0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
193
+ expected = "0.13.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
194
194
  actual = Appstats::Logger.entry_to_s("address_search")
195
195
  actual.should == expected
196
196
  end
197
197
 
198
198
  it "should handle numbers" do
199
- expected = "0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=1 : note=2.2"
199
+ expected = "0.13.1 setup[:,=,-n] 2010-09-21 23:15:20 action=1 : note=2.2"
200
200
  actual = Appstats::Logger.entry_to_s(1,:note => 2.2)
201
201
  actual.should == expected
202
202
  end
203
203
 
204
204
  it "should handle default contexts" do
205
205
  Appstats::Logger.default_contexts[:app_name] = "market"
206
- expected = "0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : app_name=market"
206
+ expected = "0.13.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : app_name=market"
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 contexts (and sort them by symbol)" do
212
- expected = "0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
212
+ expected = "0.13.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
213
213
  actual = Appstats::Logger.entry_to_s("address_filter", { :server => "Live", :app_name => 'Market' })
214
214
  actual.should == expected
215
215
  end
216
216
 
217
217
  it "should handle actions with the delimiter (and change the delimiter)" do
218
- expected = "0.13.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n"
218
+ expected = "0.13.1 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n"
219
219
  actual = Appstats::Logger.entry_to_s("address:=search-n")
220
220
  actual.should == expected
221
221
 
222
- expected = "0.13.0 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n"
222
+ expected = "0.13.1 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n"
223
223
  actual = Appstats::Logger.entry_to_s("address::search==--n")
224
224
  actual.should == expected
225
225
  end
226
226
 
227
227
  it "should handle contexts with the delimiter (and change the delimiter)" do
228
- expected = "0.13.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n"
228
+ expected = "0.13.1 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n"
229
229
  actual = Appstats::Logger.entry_to_s("address", :server => 'market:eval=-n')
230
230
  actual.should == expected
231
231
  end
232
232
 
233
233
  it "should ignore spaces" do
234
- expected = "0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address search"
234
+ expected = "0.13.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address search"
235
235
  actual = Appstats::Logger.entry_to_s("address search")
236
236
  actual.should == expected
237
237
  end
238
238
 
239
239
  it "should convert newlines in action" do
240
- expected = "0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_-nsearch"
240
+ expected = "0.13.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_-nsearch"
241
241
  actual = Appstats::Logger.entry_to_s("address_\nsearch")
242
242
  actual.should == expected
243
243
  end
244
244
 
245
245
  it "should convert newlines in context" do
246
- expected = "0.13.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : blah=some-nlong-nstatement"
246
+ expected = "0.13.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : blah=some-nlong-nstatement"
247
247
  actual = Appstats::Logger.entry_to_s("address_search",:blah => "some\nlong\nstatement")
248
248
  actual.should == expected
249
249
  end
250
250
 
251
251
  it "should convert newlines based on the delimiter" do
252
- expected = "0.13.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=--nsearch-n"
252
+ expected = "0.13.1 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=--nsearch-n"
253
253
  actual = Appstats::Logger.entry_to_s("address:=\nsearch-n")
254
254
  actual.should == expected
255
255
  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: 43
4
+ hash: 41
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 13
9
- - 0
10
- version: 0.13.0
9
+ - 1
10
+ version: 0.13.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew Forward
@@ -182,6 +182,7 @@ files:
182
182
  - lib/appstats/version.rb
183
183
  - lib/daemons/appstats_log_collector.rb
184
184
  - lib/daemons/appstats_log_collector_ctl
185
+ - lib/templates/appstats.yml
185
186
  - lib/templates/appstats_config.rb
186
187
  - pkg/appstats-0.0.1.gem
187
188
  - pkg/appstats-0.0.1.tgz